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

The <schema> element and namespaces

From: <jeffrafter@earthlink.net>
Date: Wed, 15 Aug 2001 03:05:43 -0400 (EDT)
Message-ID: <005001c12558$8fc533a0$f181fea9@abraham>
To: <xmlschema-dev@w3.org>
Hi everyone,

I just needed a quick clarification (or confirmation) of some general views
I have floating in my mind... We see this all the time:

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

So if we have:

<xs:element name="foo" type="xs:string"/>

we know that xs:string QName is interpretted as
{http://www.w3.org/2001/XMLSchema}string. However if we have:

<xs:element name="foo" type="elType"/>
<xs:complexType name="elType">

What does elType mean? There is no in-scope default namespace. According to
QName interpretation and resolution the QName should equal {}elType. The
only sub-component with a localName elType has a targetNamespace of
http://www.example.com. It should not resolve. Many schema processors will
hanlde this (e.g. Xerces)-- when they should be raising an error. The
wording of the spec seems to indicate that a namespace declaration for the
targetNamespace is *always* required-- while common practice does not.

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

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com" xmlns="http://www.example.com">

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

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

In (a) and (b) we see the two common alternatives for targetNamespaces. (c)
and (d) are merely a guess-- I am not sure if this logic works as the rec
makes a specific case against the equality of _no namespace_ and _absent_
(which I think is good...).

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

Another option is to be ultra-explicit. In (e) the expectation is that all
QName references in the schema will use the prefix target: when referring to
components declared in the targetNamespace. This also gets weird with no

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

Any thoughts?

[1] http://www.w3.org/TR/xmlschema-1/#src-qname
[2] http://www.w3.org/TR/xmlschema-1/#src-resolve

Jeff Rafter
Defined Systems
XML Development and Developer Web Hosting
Received on Friday, 17 August 2001 05:48:58 UTC

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