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

Mixing schemaLocation and noNamespaceSchemaLocation?

From: Roger L. Costello <costello@mitre.org>
Date: Thu, 29 Mar 2001 13:50:34 -0500
Message-ID: <3AC383FA.4B3B81B7@mitre.org>
To: xmlschema-dev@w3.org, costello@mitre.org
Hi Folks,

Question 1: can an instance document conform to multiple no-namespace
schemas?  That is, is this legal:

     xsi:noNamespaceSchemaLocation="BookCatalogue.xsd  Reviewer.xsd"

where BookCatalogue.xsd and Reviewer.xsd are two no-namespace schemas.

Alternatively, is this legal:

     xsi:noNamespaceSchemaLocation="BookCatalogue.xsd"
     xsi:noNamespaceSchemaLocation="Reviewer.xsd"

[Note: XSV rejects both of these.] 

Motivation for the Question

I have a no-namespace schema which contains an <any> element:

   <xsd:element name="Book">
      <xsd:complexType>
         <xsd:sequence>
            <element name="Title" type="xsd:string"/>
            <element name="Author" type="xsd:string"/>
            <any namespace="##local" minOccurs="0"/>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>

In my instance document I would like to follow the <Author> element with
a <Reviewer> element, where the <Reviewer> element is declared in a
separate no-namespace schema.  Thus, in my instance document I would
need to specify the two no-namespace schemas being used, as I show
above.

Question 2: can an instance document conform to a no-namespace schema as
well as a schema with a targetNamespace?  Is this legal in an instance
document:

     xsi:noNamespaceSchemaLocation="BookCatalogue.xsd"
     xsi:schemaLocation="http://www.reviewer.org  Reviewer.xsd"

Motivation for the Question

Consider the above example.  Suppose that the <any> element is changed
to specify that the elements can come from any namespace:

    <any namespace="##any" minOccurs="0"/>

Suppose that the Reviewer element is now declared in a schema that has a
targetNamespace.  Then in the instance document we would need to specify
the two namespaces: the BookCatalogue no-namespace schema, and the
Reviewer has-namespace schema.

/Roger
Received on Thursday, 29 March 2001 13:50:29 GMT

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