Question about Chameleon schemas

There is so much confusion about Chameleon components.  I want to make
absolutely certain that I am not misunderstanding anything.

Let's take an example.  Here's a no-namespace schema:

BookCatalogue.xsd
------------------------------------------------------
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified">
    <xsd:complexType name="CardCatalogueEntry">
        <xsd:sequence>
            <xsd:element name="Title" 
                         type="xsd:string"/>
            <xsd:element name="Author" 
                         type="xsd:string"/>
            <xsd:element name="Date" 
                         type="xsd:string"/>
            <xsd:element name="ISBN" 
                         type="xsd:string"/>
            <xsd:element name="Publisher"
                         type="xsd:string" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="Book" 
                 type="CardCatalogueEntry"/>
</xsd:schema>
------------------------------------------------------

Note that this schema has two components - a Book element and a
CardCatalogueEntry type - which are coupled, that is, Book references
CardCatalogueEntry:

          Book --> CardCatalogueEntry

Below is a schema with a targetNamespace, which <include>s the above
no-namespace schema:

Library.xsd
------------------------------------------------------
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.library.org"
            xmlns="http://www.library.org"
            elementFormDefault="qualified">
    <xsd:include schemaLocation="BookCatalogue.xsd"/>
    <xsd:element name="Library">
        <xsd:complexType>
             <xsd:sequence>
                 <xsd:element name="BookCatalogue">
                     <xsd:complexType>
                         <xsd:sequence>
                             <xsd:element ref="Book"
                                 maxOccurs="unbounded"/>
                         </xsd:sequence>
                     </xsd:complexType>
                 </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>
------------------------------------------------------

Here's my understanding of what happens when this schema <include>s the
no-namespace schema:

[1] The two global components in the no-namespace schema are
namespace-coerced to the <include>ing schema's targetNamespace, i.e, 

    {Absent}Book --> {http://www.library.org}Book

    {Absent}CardCatalogueEntry --> 
          {http://www.library.org}CardCatalogueEntry
 
[2] The reference in the declaration of Book changes from:

   Book --> {Absent}CardCatalogueEntry

to
   Book -->{http://www.library.org}CardCatalogueEntry

Consequently, as long as the <include>ing schema's default namespace is
the targetNamespace then Book's reference to CardCatalogueEntry will
resolve correctly.  If the default namespace is XMLSchema then the
reference will fail (since there is no CardCatalogueEntry in the
XMLSchema namespace).

Is this correct?

There is a statment in the spec which makes me a bit nervous.  In
section 4.2.1 it has a Note which says:

"NOTE: As discussed in Missing Sub-components (§5.3), ˇQNameˇs in XML
representations may fail to ˇresolveˇ, rendering components incomplete
and unusable because of missing subcomponents. During schema
construction, implementations are likely to retain ˇQNameˇ values for
such references, in case subsequent processing provides a referent.
ˇAbsentˇ target ˇnamespace nameˇs of such as-yet unresolved reference
ˇQNameˇs in <include>d components **should** also be converted if clause
3.2 is satisfied."

As I read it, the last sentence here is saying that if an unqualified
reference is made within the
Chameleon schema then the namespace URI used in resolving the reference
is the target namespace of the including schema.

What makes me nervous is that it says "should".  It does not say
"must".  Am I to assume then that some implementations may not resolve
unqualified references within the Chameleon schema to the target
namespace of the including schema?  /Roger

Received on Friday, 22 June 2001 17:39:27 UTC