W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2001

Re: how to refer to non-namespaced schemas

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 29 Oct 2001 16:59:54 +0000
To: "Schwarzhoff, Kelly" <kelly.schwarzhoff@commerceone.com>
Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Message-ID: <f5bhesi2xh1.fsf@cogsci.ed.ac.uk>
"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.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema.xsd">
 <xs:element name="foo"/>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema.xsd"

 <xs:import schemaLocation="A.xsd"/>

 <xs:complexType name="baz">
   <xs:element ref="foo"/>

 <xs:element name="baz" type="me:baz"/>

Note in particular that the reference to foo is unqualified, because
unprefixed in the absence of a default namespace declaration.

  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 11:59:06 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:57 UTC