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

XSV1.2 and Chameleon schemas

From: <Mike_Leditschke@nemmco.com.au>
Date: Wed, 13 Jun 2001 21:44:22 +1000
To: xmlschema-dev@w3.org
Message-ID: <OFF0F1204E.39D8C52E-ON4A256A6A.003E6E56@nemmco.com.au>
I am having difficulty validating
an instance of a schema that employs
chameleon sub-schema. I'm using
XSV1.2 for NT.

The instance is as follows


<?xml version="1.0"?>
<ns:NMI xmlns:ns="test" xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="test schema1.xsd">1234567890</ns:NMI>


Schema1 defines the target and default namespaces as "test" and
includes a second schema. Schema1 is as follows


<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     targetNamespace="test" xmlns="test">
     <xsd:include schemaLocation="schema2.xsd"/>
</xsd:schema>


Schema 2 defines a few types and an element for the
document root as follows


<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

     <xsd:simpleType name="NMIBase">
          <xsd:restriction base="xsd:string">
               <xsd:length value="10"/>
          </xsd:restriction>
     </xsd:simpleType>

     <xsd:simpleType name="NMIChecksum">
          <xsd:restriction base="xsd:integer">
               <xsd:minInclusive value="0"/>
               <xsd:maxInclusive value="9"/>
          </xsd:restriction>
     </xsd:simpleType>

     <xsd:complexType name="NMI">
          <xsd:simpleContent>
               <xsd:extension base="NMIBase">
                    <xsd:attribute name="checksum" type="NMIChecksum" use
="optional"/>
               </xsd:extension>
          </xsd:simpleContent>
     </xsd:complexType>

     <xsd:element name="NMI" type="NMI"/>
</xsd:schema>

When validating the instance, I get the error

Undefined type {None}:NMIBase referenced as base type of [anonymous].

If I understand chameleon schemas correctly, NMIBase should be
assumed to be in the "test" namespace due to the combination of the
default namespace ("test") and the targetNamespace on the enclosing
schema ("test").

This looks like a bug to me.

If I include a copy of the targetNamespace and default namespace attributes
from schema1 into schema2, no errors are reported.

Anyone see anything obvious I've overlooked?

Henry, do I get a mintie?

Regards
Michael

(See attached file: NMI.out)(See attached file: NMI.xml)(See attached file:
schema1.xsd)(See attached file: schema2.xsd)



Received on Wednesday, 13 June 2001 07:45:49 GMT

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