- From: Schwarzhoff, Kelly <kelly.schwarzhoff@commerceone.com>
- Date: Mon, 29 Oct 2001 10:52:24 -0800
- To: "'ht@cogsci.ed.ac.uk'" <ht@cogsci.ed.ac.uk>
- Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
- Message-ID: <C1E0143CD365A445A4417083BF6F42CC01503632@C1plenaexm07.commerceone.com>
Hi Henry,
Is there anywhere in the spec that explains this fact? The reason I ask is
because I have tested similiar schemas in Xerces, and--even when there is no
default namespace--if there is a reference to a type, and it is unqualified,
Xerces treats it like a reference to a type in the current namespace.
Kelly
-----Original Message-----
From: ht@cogsci.ed.ac.uk [mailto:ht@cogsci.ed.ac.uk]
Sent: Monday, October 29, 2001 9:00 AM
To: Schwarzhoff, Kelly
Cc: 'www-xml-schema-comments@w3.org'
Subject: Re: how to refer to non-namespaced schemas
"Schwarzhoff, Kelly" <kelly.schwarzhoff@commerceone.com> writes:
> If I have a schema--call it schema A--with no namespace, and it is
imported
> by another schema--call it schema B--which does have a namespace (I do
this
> by using schemaLocation attribute, not namespace attribute), then how does
> schema B refer to types in schema A. The reason I ask is because it
appears
> to be impossible, as there is no namespace so one would have to refer to
it
> of a QName where there is no prefix. In these cases though, if no
namespace
> is referenced, then when in schema B non-prefixed type references are
> assumed to refer to types in current schema (B).
It all works just fine, you just have to be careful with your
namespace prefixes. See below.
A.xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema.xsd">
<xs:element name="foo"/>
</xs:schema>
B.xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema.xsd"
xmlns:me="urn:example"
targetNamespace="urn:example">
<xs:import schemaLocation="A.xsd"/>
<xs:complexType name="baz">
<xs:sequence>
<xs:element ref="foo"/>
</xs:sequence>
</xs:complexType>
<xs:element name="baz" type="me:baz"/>
</xs:schema>
Note in particular that the reference to foo is unqualified, because
unprefixed in the absence of a default namespace declaration.
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 Monday, 29 October 2001 13:53:06 UTC