W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2001

Bug in XSV?

From: Roger L. Costello <costello@mitre.org>
Date: Sat, 24 Feb 2001 06:33:31 -0500
Message-ID: <3A979C0B.FD5006DA@mitre.org>
To: xmlschema-dev@w3.org, costello@mitre.org
Hi Folks,

XSV is generating an error when a no-namespace schema (containing
components that reference one another) is <include>d into a schema with
a targetNamespace.

Consider this no-namespace schema:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
    <xsd:complexType name="CardCatalogueEntry">
            <xsd:element name="Title" type="xsd:string"/>
            <xsd:element name="Author" type="xsd:string"/>
            <xsd:element name="Date" type="xsd:string"/>
            <xsd:element name="ISBN" type="xsd:string"/>
            <xsd:element name="Publisher" type="xsd:string" />
    <xsd:element name="Book" type="CardCatalogueEntry"/>

This schema has two components - a complexType CardCatalogueEntry
component and an element Book component.  The Book component references
the CardCatalogueEntry component. 

Consider what happens when these components are included in a schema
with a namespace.  

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
    <xsd:include schemaLocation="BookCatalogue.xsd"/>
    <xsd:element name="Library">
                 <xsd:element name="BookCatalogue">
                             <xsd:element ref="Book"/>

Note that the targetNamespace is the default namespace.  When the
no-namespace components (Book and CardCatalogueEntry) are included in
this schema they take on the targetNamespace.  Consequently, this
element declaration in the no-namespace schema:

    <xsd:element name="Book" type="CardCatalogueEntry"/>

should be referencing a CardCatalogueEntry component in the
targetNamespace. [Or, is Book still referencing CardCatalogueEntry in
no-namespace?  Do only the components take on the namespace of the
<include>ing schema, or do the references also take on the namespace?  I
am not clear on this.]  

When I ran this example in XSV I got this error message:

Undefined type {None}:CardCatalogueEntry referenced as type definition
of Book

This would seem to suggest that:

    <xsd:element name="Book" type="CardCatalogueEntry"/>

is still referencing the CardCatalogueEntry in no-namespace (as opposed
to a reference to CardCatalogueEntry in the default namespace).

There are two possibilities:

{1} XSV has a bug and type="CardCatalogueEntry" is a reference to the
CardCatalogueEntry in the default namespace (which in my schema is the

{2} There is no bug in XSV and type="CardCatalogueEntry" is a reference
to the CardCatalogueEntry in no-namespace, and XSV's error message is

Can you please enlighten me as to the true nature of <include>ing
coupled no-namespace components - when no-namespace components are
<include>d in a schema do the no-namespace component references become
references to the <include>ing schema's default namespace, or do they
continue as references to no-namespace? /Roger
Received on Saturday, 24 February 2001 06:32:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:51 UTC