RE: Multiple imports of the same namespace

The spec unfortunately is very vague on this. The schemaLocation is just a
hint as to where to find a schema for a given namespace. If the system
thinks it already has a schema for that namespace, it's entitled to assume
that it's another copy of the same schema, and I think that's what Xerces is
doing. It's best to assemble a complete schema for a namespace using
xs:include, and then import the assembled schema.

Michael Kay 

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of JGLACE@lmi.org
> Sent: 23 August 2004 15:16
> To: xmlschema-dev@w3.org
> Subject: Multiple imports of the same namespace
> 
> 
> I am receiving an error when I validate a Schema that has multiple
> imports of the same namespace when I use XerceJ 2.6.2. I've 
> recreated my
> problem using some simplified Schemas below.
> 
> I'm hoping this group can verify that my Schema are correct. The main
> question being is importing multiple files of the same namespace legal
> and am I using the correct syntax. 
> 
> Thank you in advance for taking the time to read and respond.
> 
> Diamonds2.xsd
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="www.gemsRUS.com"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> xmlns:gems="www.gemsRUS.com"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 	<xs:complexType name="DiamondType">
> 		<xs:sequence>
> 			<xs:element ref="gems:Color"/>
> 			<xs:element ref="gems:Cut"/>
> 			<xs:element ref="gems:Clarity"/>
> 			<xs:element ref="gems:Karat"/>
> 		</xs:sequence>
> 	</xs:complexType>
> 	<xs:element name="Color" type="xs:string"/>
> 	<xs:element name="Cut" type="xs:string"/>
> 	<xs:element name="Clarity" type="xs:string"/>
> 	<xs:element name="Karat" type="xs:integer"/>
> </xs:schema>
> 
> Pearls2.xsd
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="www.gemsRUS.com"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> xmlns:gems="www.gemsRUS.com"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 	<xs:complexType name="PearlType">
> 		<xs:sequence>
> 			<xs:element ref="gems:size"/>
> 			<xs:element ref="gems:shape"/>
> 			<xs:element ref="gems:color"/>
> 			<xs:element ref="gems:luster"/>
> 			<xs:element ref="gems:surfaceCleanliness"/>
> 		</xs:sequence>
> 	</xs:complexType>
> 	<xs:element name="size" type="xs:integer"/>
> 	<xs:element name="shape" type="xs:string"/>
> 	<xs:element name="color" type="xs:string"/>
> 	<xs:element name="luster" type="xs:string"/>
> 	<xs:element name="surfaceCleanliness" type="xs:string"/>
> </xs:schema>
> 
> 
> Jewlery2.xsd
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema targetNamespace="www.jewleryRUS.com"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> xmlns:jewels="www.jewleryRUS.com"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:gems="www.gemsRUS.com">
> 	<xs:import namespace="www.gemsRUS.com"
> schemaLocation="Pearls2.xsd"/>
> 	<xs:import namespace="www.gemsRUS.com"
> schemaLocation="Diamonds2.xsd"/>
> 	<xs:element name="Diamonds" type="gems:DiamondType"/>
> 	<xs:element name="Pearls" type="gems:PearlType"/>
> </xs:schema>
> 
> Xerce's error message:
> 
> Line 5, Column 55: src-resolve: Cannot resolve the name
> 'gems:DiamondType' to a(n) 'type definition' component. 
> 
> As a side note, Turbo 2.4.1 is not resolving this either (could it be
> built on Xerces?).
> 
> Kind regards,
> Jessica Glace
> LMI http://www.lmi.org/
> 2000 Corporate Ridge
> McLean, VA 22102-7805
> Jglace at lmi.org
> 
> 
> 

Received on Monday, 23 August 2004 14:34:37 UTC