I'm having a schema hierarchy like this:
common |---legacy | |---legacy.xsd xmlns="http://common/legacy" | |---other.xsd xmlns="http://common/legacy" | '---....xsd xmlns="http://common/legacy" |---send |---file.xsd xmlns="http://common/send" '---text.xsd xmlns="http://common/send" '---....xsd xmlns="http://common/send"
All files in one folder have the same namespace.
Now I want to map the namespaces to specific java packages (I cannot change the namespace).
I found a solution to bind a schema to a package. But then I would have to create one entry per xsd-file:
<jaxb:bindings schemaLocation="./common/legacy/legacy.xsd"> <jaxb:schemaBindings> <jaxb:package name="com.company/legacy"/> </jaxb:schemaBindings> </jaxb:bindings> <jaxb:bindings schemaLocation="./common/legacy/other.xsd"> <jaxb:schemaBindings> <jaxb:package name="com.company/legacy"/> </jaxb:schemaBindings> </jaxb:bindings> .....
Is there a way to directly define a binding between namespace and a package name?
The other way would be to define the package in maven:
<plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <configuration> <generatePackage>com.company/legacy</generatePackage> </configuration> </plugin>
But then I would have to create one execution per folder, which is not really what I want.