I have a couple of comprehensive XSDs which inlcude the same complexType definition for the same member. Each XSD has its own namespace. So when I run xjc
on the xsds, I get the same complexType class generated in each namespace.
This ends up being extremely confusing and complicated to handle. I would like to create a binding that tells XJC not to generate the complexType for one of the XSDs and rather to use the class already generated by the other xsd.
I've tried the following without success:
<jaxb:bindings schemaLocation="../xsd/sandboxlist.xsd">
<jaxb:bindings node="/xsd:schema">
<jaxb:schemaBindings>
<jaxb:package name="com.domain.schema.model.v4_0.sandboxlist"/>
</jaxb:schemaBindings>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='SandboxType']">
<jaxb:class name="com.domain.schema.model.v4_0.sandboxinfo.SandboxType" />
</jaxb:bindings>
</jaxb:bindings>
I am looking to tell XJC that SandboxType
in sandboxlist.xsd should actually be class com.domain.schema.model.v4_0.sandboxinfo.SandboxType
(coming from a different XSD).
What is the proper syntax for this?
You can achieve this via jaxb:class/@ref
:
<jaxb:class ref="com.domain.schema.model.v4_0.sandboxinfo.SandboxType" />
But, better, use episodes. Generate using -episode
CLI parameter and then add your JAR to the xjc
command line.