- From: <jeffrafter@earthlink.net>
- Date: Wed, 15 Aug 2001 03:05:43 -0400 (EDT)
- 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"
targetNamespace="http://www.example.com">
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">
...
</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. 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.
(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...).
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com"
xmlns:target="http://www.example.com">
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
namespace
<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
Thanks!
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting
Received on Friday, 17 August 2001 05:48:58 UTC