I'm trying to map the following to a new class name via the maven-jaxb2-plugin.
I have this element that exists in two XSD's in the project (different namespaces).
I want to map this instance to a different classname so that it compiles.
<xs:complexType name="ResponseCommonData">
<xs:sequence>
<xs:element name="RequestID" type="xs:string"/>
<xs:element name="BusinessError" form="qualified" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:extension base="BusinessErrorCommonData"/>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="BusinessCommonData">
<xs:sequence>
<xs:element name="Code" type="xs:string" form="unqualified" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
The bindings.xjb I have is...
<jaxb:bindings schemaLocation="CFRV2.0.0.xsd" node="/xs:schema">
<jaxb:bindings node="xs:complexType[@name='ResponseCommonData']">
<jaxb:property name="CFRResponseCommonData" />
</jaxb:bindings>
<jaxb:bindings node="xs:complexType[@name='BusinessCommonData']">
<jaxb:property name="CFRBusinessCommonData" />
</jaxb:bindings>
</jaxb:bindings>
The error I get is this...
org.xml.sax.SAXParseException: A class/interface with the same name
"com.ResponseCommonData" is already in use.
Use a class customization to resolve this conflict.
If I remove the inner element BusinessError from ResponseCommonData then the JAXB will proceed on, but giving me a similar message about another complex type class.
Use jaxb:class
instead of jaxb:property
.