users@jaxb.java.net

Does JAXB support importing from a different namespace?

From: Shelton, Mark <Mark.Shelton_at_nielsenmedia.com>
Date: Mon, 28 Jun 2004 09:35:37 -0400

I am using jwsdp 1.3 and trying to import schemas from a different
namespace.
 
When compiling the schemas using jaxb (using the xjc ant task), it compiles
the import statements with no problems, but when an element is reference
from the imported schema in the schema doing the import, it doesn't find the
element definition. If I change the import to an include and change
everything to the same namespace, there is no problem.
 
Does jaxb support importing schemas from a difference namespace and the use
of classes from a different package?
 
Does it try to generated those classes in that different package or does it
just try to use those classes?
 
Here is an example of what I am trying to do:
 
With the imports:

<xs:schema
targetNamespace="local:nielsenmedia:business:refined:sampleSelectionAndRepor
ting"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bsr="local:nielsenmedia:business:standard:reference"
xmlns:brssr="local:nielsenmedia:business:refined:sampleSelectionAndReporting
"
elementFormDefault="qualified" version="1.0">
<xs:import
schemaLocation="http://local.nielsenmedia.com/xmlschema/business/standard/re
ference/commonGeography.xsd"
namespace="local:nielsenmedia:business:standard:reference"/>
<xs:import
schemaLocation="http://local.nielsenmedia.com/xmlschema/business/standard/re
ference/commonReference.xsd"
namespace="local:nielsenmedia:business:standard:reference"/>

With the includes:

<xs:schema targetNamespace="local:nielsenmedia:business:standard:reference"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bsr="local:nielsenmedia:business:standard:reference"
xmlns:brssr="local:nielsenmedia:business:refined:sampleSelectionAndReporting
"
elementFormDefault="qualified" version="1.0">
<xs:include
schemaLocation="http://local.nielsenmedia.com/xmlschema/business/standard/re
ference/commonGeography.xsd"/>
<xs:include
schemaLocation="http://local.nielsenmedia.com/xmlschema/business/standard/re
ference/commonReference.xsd"/>

The rest of the schema and the element references that fail with the
imports:

<xs:element name="getAverageSumOfWeightsRequest">
<xs:complexType>
<xs:sequence>
<xs:element ref="bsr:effectiveDates"/>
<xs:element ref="bsr:demographicID" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Thanks,
Mark Shelton




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net