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

Re: Unqualified type names in Schema documents without targetNamespace

From: Jeff Rafter <jeffrafter@definedweb.com>
Date: Tue, 20 Mar 2001 15:23:26 -0800
Message-ID: <005101c0b194$c4d651b0$f181fea9@lazarus>
To: "Bob Schloss" <rschloss@us.ibm.com>
Cc: <xmlschema-dev@w3.org>
Bob,

I recently did a lot of asking about this type of thing on xml-dev [1] and
got some mixed reviews.  I personally think that the way XSV is handling it
is much better (more accurate) than the wording of the schema spec.  Based
on the spec. itself, I fully agree that your examples should be valid-- if
that is not the case then I think the spec. is unclear.

Of course there is a large question in my mind as to the validity of :

"Since the empty string is a legal (relative) URI reference..."

wrt namespaces.  Clearly relative URIs for namespaces are bad practice [2].
Apart from that, there are features of defaulted namespaces the are
potentially lost with the allowance of "" as an actual namespace-- even in
the original namespace spec. there were specific functions for a namespace
of "". [3] Even if it is allowed, I will not use it myself.

[1] http://lists.xml.org/archives/xml-dev/200103/msg00714.html
[2] http://www.w3.org/2000/09/xppa
[3] http://www.w3.org/TR/REC-xml-names/#defaulting

Regards,
Jeff Rafter

----- Original Message -----
From: "Bob Schloss" <rschloss@us.ibm.com>
To: <xmlschema-dev@w3.org>
Sent: Tuesday, March 20, 2001 2:50 PM
Subject: Unqualified type names in Schema documents without targetNamespace


>
> How many namespaces can dance on the head of a pin? :-)
>
> The primer, section 3.4 says:
> In cases where a schema is designed without a target namespace, it is
> strongly recommended that all Schema elements and types are explicitly
> qualified with a prefix such as xsd: that is associated with the XML
Schema
> namespace (as in po.xsd). The rationale for this recommendation is that if
> Schema elements and types are associated with the XML Schema namespace by
> default, i.e. without prefixes, then references to XML Schema types may
not
> be distinguishable from references to user-defined types.
>
> This could be said even stronger: Do not associate
> http://www.w3.org/2001/XMLSchema with the lack of a prefix.
>
> I just had to explain to someone (who is not naive about namespaces, BTW)
> these three cases:
>
> First, a schema where I think processors would say "There is no type
called
> http://www.w3.org/2001/XMLSchema:USAddress" and "There is no type called
> http://www.w3.org/2001/XMLSchema:PurchaseOrderType".
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> >arch.ibm.com/Sketch/InvalidSchemas">
>   <element name="purchaseOrder" type="PurchaseOrderType"/>
>   <complexType name="PurchaseOrderType">
>     <sequence>
>       <element name="shipTo" type="USAddress"/>
>     </sequence>
>   </complexType>
>   <complexType name="USAddress">
>     <sequence>
>       <element name="name"   type="string"/>
>     </sequence>
>   </complexType>
> </schema>
>
> Second is a schema that improperly confuses a URI of '' with no URI:
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:a=''>
>   <element name="purchaseOrder" type="a:PurchaseOrderType"/>
>   <complexType name="PurchaseOrderType">
>     <sequence>
>       <element name="shipTo" type="a:USAddress"/>
>     </sequence>
>   </complexType>
>   <complexType name="USAddress">
>     <sequence>
>       <element name="name"   type="string"/>
>     </sequence>
>   </complexType>
> </schema>
>
>
>
> XSV says:
> attribute type check failed for {None}:type: a:PurchaseOrderType has
> undeclared prefix: a
>
> Undeclared?
>
> Structures section 3.15.2 says
> Since the empty string is a legal (relative) URI reference, supplying an
> empty string for targetNamespace is not the same as not specifying it at
> all.
>
> This makes me think that my second schema does not refer to its own
> complexType USAddress,
>
>
>
> Third is a schema which I think is legal:
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:a=''
targetNamespace
> =''>
>   <element name="purchaseOrder" type="a:PurchaseOrderType"/>
>   <complexType name="PurchaseOrderType">
>     <sequence>
>       <element name="shipTo" type="a:USAddress"/>
>     </sequence>
>   </complexType>
>   <complexType name="USAddress">
>     <sequence>
>       <element name="name"   type="string"/>
>     </sequence>
>   </complexType>
> </schema>
>
> XSV says:
> attribute type check failed for {None}:type: a:PurchaseOrderType has
> undeclared prefix: a
>
> I don't understand why it does this.
>
> I think the problem is that to be clear about how namespaces can be used
in
> W3C XML Schemas, you need to
> very carefully read Structures and Primer.
>
>
> Bob
>
>
Received on Tuesday, 20 March 2001 18:23:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:20 GMT