I'm trying to figure out a way for how to use the same .xjb bindings file for multiple xsd files.
I found a solution here for "floating global bindings": https://www.java.net/node/674443
However, the stuff I'm trying to do does not seem to be allowed under the globalBindings tag.
Here's the binding code I have for a specific .xsd:
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
jaxb:version="2.1"
jaxb:extensionBindingPrefixes="xjc inheritance">
<jaxb:bindings schemaLocation="../Specific.xsd" node="/xs:schema">
<jaxb:bindings node="//xs:complexType[@name='entity']">
<inheritance:implements>test.IEntity</inheritance:implements>
</jaxb:bindings>
<jaxb:bindings node="//xs:element[@name='entityContainer']">
<jaxb:class/>
<inheritance:implements>test.IEntityContainer</inheritance:implements>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
How do I now apply that to any .xsd in the xsd directory?
I have difficulty to believe that the only solution to this would be to actually generate the single binding files per xsd file (as outlined in the referenced forum entry above), or is it really?
Also note that the node xpath would in fact be a bit more complicated as there are different (types of) containers, I just simplified it here to not overcomplicate the example.