- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 24 Feb 2001 21:42:17 +0000
- To: "Roger L. Costello" <costello@mitre.org>
- Cc: xmlschema-dev@w3.org
"Roger L. Costello" <costello@mitre.org> writes: > 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" > elementFormDefault="qualified"> > <xsd:complexType name="CardCatalogueEntry"> > <xsd:sequence> > <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:sequence> > </xsd:complexType> > <xsd:element name="Book" type="CardCatalogueEntry"/> > </xsd:schema> > > 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" > targetNamespace="http://www.library.org" > xmlns="http://www.library.org" > elementFormDefault="qualified"> > <xsd:include schemaLocation="BookCatalogue.xsd"/> > <xsd:element name="Library"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="BookCatalogue"> > <xsd:complexType> > <xsd:sequence> > <xsd:element ref="Book"/> > </xsd:sequence> > </xsd:complexType> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > </xsd:schema> > > 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.] It should be clarified that the reference is resolved to the chameleon component. > When I ran this example in XSV I got this error message: > > Undefined type {None}:CardCatalogueEntry referenced as type definition > of Book XSV is in error here. > 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 > targetNamespace) Yes. > {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 > valid. No. ht -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2001, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/
Received on Saturday, 24 February 2001 16:42:21 UTC