Multiple imports for the same name space?

This should cover W3C XML Schema, Relax NG and DTD related problems.
Posts: 5
Joined: Thu May 26, 2005 9:16 pm

Multiple imports for the same name space?

Post by GrayMan » Thu May 26, 2005 9:44 pm

I have an XML and modular schema that validate under XMLSpy. When I attempt to validate them under Oxygen6 it appears that the second, third, ... imports within an XSD for the same namespace are ignored as I get pairs of the form

Code: Select all

cannot resolve the name 'prefix:SchemaType' to a(n) 'type definition' component
cannot resolve the name 'prefix:SchemaType' to a(n) 'simpleType definition' component
i.e., Others.xsd (in a different namespace) contains a sequence like

Code: Select all

<xs:schema targetNamespace="http://domain.tld/OTHERS"
<xs:import namespace="http://domain.tld/PREFIX" schemaLocation="http://domain.tld/PREFIX/Schema1.xsd"/>
<xs:import namespace="http://domain.tld/PREFIX" schemaLocation="http://domain.tld/PREFIX/Schema2.xsd"/>
<xs:import namespace="http://domain.tld/PREFIX" schemaLocation="http://domain.tld/PREFIX/Schema3.xsd"/>

Posts: 7529
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu » Fri May 27, 2005 9:47 am


Oxygen uses Xerces for validation.
Xerces only uses the first <xsd:import> for each namespace. It
ignores subsequent ones, leading to problems if you, as in this example,
have multiple schemas with the same namespace imported in the same schema.

Having reported this as a bug in Xerces, it was pointed out that
the spec makes supporting multiple imports into the same namespace up to the processor. Further the comment made was that they believed that they were encouraging better Schema authoring practice by disallowing this.

See the link below:

As a workaround you can define a new schema with the target namespace "http://domain.tld/PREFIX" which can include all the other schemas with the same namespace. This schema can be then imported in your main schema.

Hope this helps.
Regards, Radu.

Post Reply