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

RE: The <schema> element and namespaces

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Mon, 20 Aug 2001 10:48:14 -0400
To: <jeffrafter@earthlink.net>, <xmlschema-dev@w3.org>
Message-ID: <009001c12987$6e1a0f90$1ab0153f@xmls>
Hi Jeff,

> However if we have:
> <xs:element name="foo" type="elType"/>
> <xs:complexType name="elType">
> ...
> </xs:complexType>
> 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.

Yes, that's correct - it should not resolve.

> Many schema processors will
> hanlde this (e.g. Xerces)-- when they should be raising an error.

What version of Xerces are you using?  I tried it using 1.4.1 and it gave me
an appropriate error message.

> The wording of the spec seems to indicate that a namespace
> declaration for the
> targetNamespace is *always* required-- while common practice does not.

It is necessary if you have a target namespace and you want to make
references between components in the schema, like in your example above.

> (a)
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.example.com">
> (b)
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.example.com"
> xmlns="http://www.example.com">
> (c)
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> (d)
> <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...).

(a) would only work if did not have any references between components (all
declarations were local and used either anonymous type definitions or
built-in types.)  (c) and (d) are fine because there is no target namespace,
and all references will look for components in no namespace.

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

This is not allowed by the Namespaces rec.  You can't map the empty string
to a prefix.

Hope that helps,


> Thanks!
> Jeff Rafter
> Defined Systems
> http://www.defined.net
> XML Development and Developer Web Hosting

Priscilla Walmsley                   priscilla@walmsley.com
Architect, Vitria Technology          http://www.vitria.com
Author, Definitive XML Schema  (Prentice Hall, Dec. 2001)
Received on Monday, 20 August 2001 10:48:22 UTC

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