I'm currently attempting to use XJC to generate the java xml stubs based on a single schema which includes a few other schemas. There is 1 collision that I'm running into, and it is at the element level. The element name is "Signature". The main schema that I'm using includes the XML digital signatures schema and both define the element name of Signature. I was attempting to resolve the conflict by defining that the xmldsig Signature element be resolved to "DigitalSignature". Evidently, I'm missing something here, because I can't figure out how to define the mapping either by schema location or namespace. I'm more familiar with Castor than I am with JAXB, so I figure this should be an easy question to answer.
Here's my jaxb file:
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb bindingschema_2_0.xsd ">
<jxb:bindings schemaLocation="odm1-3-0-foundation.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:package name="org.cchmc.i2b2.odm.xml" />
</jxb:schemaBindings>
<jxb:bindings schemaLocation="xmldsig-core-schema.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:package name="org.cchmc.i2b2.odm.xml.xmldig" />
</jxb:schemaBindings>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
The schemas can be found here: http://www.cdisc.org/odm (ODM1-3-foundation and xmlsig-core-schema). The main thing of interest is that element Signature exists in both, yet the namespaces of each schema is different.
Oh, and I've tried many variations of the above, such as the following:
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb bindingschema_2_0.xsd ">
<jxb:bindings schemaLocation="odm1-3-0-foundation.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:package name="org.cchmc.i2b2.odm.xml" />
</jxb:schemaBindings>
<jxb:bindings node="//xs:element[@name='Signature' and @type='SignatureType']">
<jxb:class name="DigitalSignature">
<jxb:javadoc>
The main odm schema defines a Signature element, so this Signature element was
named to DigitalSignature as it is apart of the XML digital signature schema.
</jxb:javadoc>
</jxb:class>
</jxb:bindings>
</jxb:bindings>
If you see what I'm missing here, please feel free to point out my mistakes.