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

Re: Unqualified type names in Schema documents without targetNamespace

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 21 Mar 2001 09:47:38 +0000
To: "Bob Schloss" <rschloss@us.ibm.com>
Cc: xmlschema-dev@w3.org
Message-ID: <f5b3dc74fnp.fsf@cogsci.ed.ac.uk>
"Bob Schloss" <rschloss@us.ibm.com> writes:

<snip/>

> 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.

Sorry for the confusion -- my fault.  Turns out this case is forbidden 
_by the Namespace REC_:

  "[Definition:] If the attribute name matches PrefixedAttName, then
  the NCName gives the namespace prefix, used to associate element and
  attribute names with the namespace name in the attribute value in
  the scope of the element to which the declaration is attached. In
  such declarations, the namespace name may not be empty." [1]

So that error is correct, as the namespace declaration for 'a' didn't
happen, being illegal.

> This makes me think that my second schema does not refer to its own
> complexType USAddress,

Correct.

> 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.

See above.

> 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.

For sure, and the remark about '' in Structures needs to be fixed.

ht

[1] http://www.w3.org/TR/REC-xml-names/#ns-decl
-- 
  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 Wednesday, 21 March 2001 04:47:41 GMT

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