W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2002

problem with import/include and XSV type qualified by non-local namespace

From: Colin Mackenzie <colin@elecmc.com>
Date: Wed, 13 Mar 2002 15:13:11 -0000
To: <xmlschema-dev@w3.org>
Message-ID: <PJEOKNCGPHICMMDPMNAJMEPOCCAA.colin@elecmc.com>
Hi,

I have a top level schema (see top.xsd below) that includes other schemas
with the same namespace.

These "sub-schemas" use types defined in a schema of another namespace. To
avoid importing the other schemas multiple times (i.e. once in each sub
schema) I import the other namespace schema in the top level schema
(top.xsd).

This seems to work OK in XMLSpy and Turbo XML but using XSV I get an error
when one of my subschemas attempts to use a type from the other namespace.
The error is:"attribute type check failed for {None}:type: yours:YourType is
qualified by an unimported non-local namespace"

This seems to point to XSV saying that the other namespace schema should be
imported in the schema file in which uses that type (rather in the level
above).

Is XSV correct, have I made a mistake or is this a bug?

Schemas and sample XML file below (reduced from original problem)

Thanks

Colin Mackenzie

top.xsd

----------

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema targetNamespace="http://my.uk/test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://my.uk/test"
xmlns:my="http://my.uk/test" xmlns:yours="http://yours.uk/testyours"
elementFormDefault="qualified" attributeFormDefault="unqualified">

<xsd:import schemaLocation="yours.xsd"
namespace="http://yours.uk/testyours"/>

<xsd:include schemaLocation="mine.xsd"/>

<xsd:element name="top" type="mytype"/>

</xsd:schema>

mine.xsd

-----------

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://my.uk/test" xmlns:my="http://my.uk/test"
xmlns:yours="http://yours.uk/testyours" elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xsd:complexType name="mytype">

<xsd:sequence>

<xsd:element name="MyElement" type="yours:YourType"/>

</xsd:sequence>

</xsd:complexType>

</xsd:schema>

yours.xsd

------------

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://yours.uk/testyours"
xmlns="http://yours.uk/testyours" elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xsd:complexType name="YourType">

<xsd:sequence>

<xsd:element name="YourElement"/>

</xsd:sequence>

</xsd:complexType>

</xsd:schema>

test.xml

---------

<?xml version="1.0" encoding="UTF-8"?>

<top xmlns="http://my.uk/test" xmlns:yours="http://yours.uk/testyours"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://my.uk/test top.xsd">

<MyElement>

<yours:YourElement/>

</MyElement>

</top>
Received on Wednesday, 13 March 2002 10:13:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT