users@jaxb.java.net

root element collision on the JAXBContext

From: Greg Burrow <burrow_at_nortelnetworks.com>
Date: Fri, 8 Aug 2003 12:34:35 -0500

Is it possible to use the two following schemas without causing a root
element collision on the JAXBContext? Each schema is compiled into its own
package, but is used by the same JAXBContext.

Here is what I am attempting...
jc = JAXBContext.newInstance( rss1Package + ":" + rss2Package );

SCHEMA 1

<xsd:schema
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:rss="http://rss/1.0/"
  targetNamespace="http://rdf"
  elementFormDefault="qualified">

  <xsd:import namespace="http://rss/1.0/" schemaLocation="rss1.xsd"/>

  <xsd:element name="RDF">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="rss:channel" minOccurs="1" maxOccurs="1"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>



SCHEMA 2

<xsd:schema
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:rss="http://rss/2.0/"
    targetNamespace="http://rdf"
    elementFormDefault="qualified">

    <xsd:import namespace="http://rss/2.0/" schemaLocation="rss2.xsd"/>

    <xsd:element name="RDF">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element ref="rss:channel" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:element>
</xsd:schema>


Thanks,

Greg