W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

Re: qname resolution question

From: Jeni Tennison <jeni@jenitennison.com>
Date: Mon, 31 Dec 2001 20:54:40 +0000
Message-ID: <731716137.20011231205440@jenitennison.com>
To: "Takuki Kamiya" <takuki@pacbell.net>
CC: xmlschema-dev@w3.org
Hi Taki,

> I am wondering if the following schema is valid or not. Both XSV and
> xerces passes validation with it.
>
> What is the namespace name for the "documentBody" qname below? Is it
> "http://www.w3.org/2001/XMLSchema", or is it none (as
> targetNamespace is not provided)?

The schema is not valid because the reference to the QName
'documentBody' is resolved using the default namespace, which is the
XML Schema namespace http://www.w3.org/2001/XMLSchema. The schema
validator looks for an element declaration for
{http://www.w3.org/2001/XMLSchema}documentBody, and finds none, and
should give an error (XSV, MSV and Xerces-C++ all give an error).

To create a schema for no namespace in which you reference types and
element/attribute declarations, you need to use a prefix for the XML
Schema namespace:

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

<xs:element name = "envelope">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref = "documentBody"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

<xs:element name = "documentBody" type="anyType"/>
  
</xs:schema>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Tuesday, 1 January 2002 04:52:25 GMT

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