title: How to use JAXB to process messages from two separate schemas (with same rootelement name)
body: <p>We have a client that is sending xml messages that are produced from two separate schemas.</p>
  
  <p>We would like to process them in a single application, since the content is related.</p>
  
  <p>We cannot modify the client's schema that they are using to produce the XML messages...</p>
  
  <p>We can modify our own copies of the two schema (or binding.jxb) -- if it helps -- in order to enable our JAXB processing of messages created from the two separate schemas.</p>
  
  <p>Unfortunately, both schemas have the same root element name (see below).</p>
  
  <p>QUESTION:  Does JAXB prohibit absolutely the processing two schemas that have the same root element name?<br>
  -- If so, I will stop my "easter egg" hunt for a solution to this...
  ---Or, is there some workaround that would enable us to use JAXB for processing these XML messages produced from two different schemas?</p>
  
  <p>schema1 (note the root element name: "A"):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified"&gt;
      &lt;xsd:element name="A"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element name="AA"&gt;
                      &lt;xsd:complexType&gt;
                          &lt;xsd:sequence&gt;
                              &lt;xsd:element name="AAA1" type="xsd:string" /&gt;
                              &lt;xsd:element name="AAA2" type="xsd:string" /&gt;
                              &lt;xsd:element name="AAA3" type="xsd:string" /&gt;
                          &lt;/xsd:sequence&gt;
                      &lt;/xsd:complexType&gt;
                  &lt;/xsd:element&gt;
                  &lt;xsd:element name="BB"&gt;
                      &lt;xsd:complexType&gt;
                          &lt;xsd:sequence&gt;
                              &lt;xsd:element name="BBB1" type="xsd:string" /&gt;
                              &lt;xsd:element name="BBB2" type="xsd:string" /&gt;
                          &lt;/xsd:sequence&gt;
                      &lt;/xsd:complexType&gt;
                  &lt;/xsd:element&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>schema2 (note, again, using the same root element name: "A")</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified"&gt;
      &lt;xsd:element name="A"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element name="CCC"&gt;
                      &lt;xsd:complexType&gt;
                          &lt;xsd:sequence&gt;
                              &lt;xsd:element name="DDD1" type="xsd:string" /&gt;
                              &lt;xsd:element name="DDD2" type="xsd:string" /&gt;
                          &lt;/xsd:sequence&gt;
                      &lt;/xsd:complexType&gt;
                  &lt;/xsd:element&gt;
                  &lt;xsd:element name="EEE"&gt;
                      &lt;xsd:complexType&gt;
                          &lt;xsd:sequence&gt;
                              &lt;xsd:element name="EEE1"&gt;
                                  &lt;xsd:complexType&gt;
                                      &lt;xsd:sequence&gt;
                                          &lt;xsd:element name="FFF1" type="xsd:string" /&gt;
                                          &lt;xsd:element name="FFF2" type="xsd:string" /&gt;
                                      &lt;/xsd:sequence&gt;
                                  &lt;/xsd:complexType&gt;
                              &lt;/xsd:element&gt;
                              &lt;xsd:element name="EEE2" type="xsd:string" /&gt;
                          &lt;/xsd:sequence&gt;
                      &lt;/xsd:complexType&gt;
                  &lt;/xsd:element&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  </code></pre>