We have a client that sends xml messages created from two separate schemes.
We would like to process them in one application, as the content is connected.
We cannot change the client schema that they use to create XML messages ...
We can modify our own copies of two schemes (or binding.jxb) - if that helps - so that our JAXB message processing is created from two separate schemes.
Unfortunately, both schemes have the same root element name (see below).
QUESTION: Is JAXB absolutely prohibiting the processing of two schemes that have the same root element name?
- If so, I will stop my Easter egg hunt to solve this ... --- Or is there some workaround that will allow us to use JAXB to process these XML messages created from two different schemes?
schema1 (note the name of the root element: "A"):
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="A">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="AA">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="AAA1" type="xsd:string" />
<xsd:element name="AAA2" type="xsd:string" />
<xsd:element name="AAA3" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="BB">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="BBB1" type="xsd:string" />
<xsd:element name="BBB2" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
schema2 (note, again, using the same root element name: "A")
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="A">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CCC">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DDD1" type="xsd:string" />
<xsd:element name="DDD2" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="EEE">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EEE1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="FFF1" type="xsd:string" />
<xsd:element name="FFF2" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="EEE2" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
sairn source
share