Re: Feature incompatiblity in XML Schema 1.0

You analysis is correct, but I don't understand the implicit
evaluative component of your message - why is this a problem that
needs to be fixed?  By making a declaration both local and qualified,
the author has essentially staked a permanent claim on the association
between those qualifided names and their types in that context.  You can
override this, but to do so you have to usurp the author's namespace
explicitly, either using <redefine>, or as follows:

a.xsd:
<xs:schema targetNamespace="urn:a:aaa" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:a="urn:a:aaa" >
  <xs:complexType name="Base" >
    <xs:sequence>
      <xs:element name="x" type="xs:int" form="qualified" />
      <xs:element name="y" type="xs:int" minOccurs="0" form="qualified"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="BE" type="a:Base" />
</xs:schema>
 
aprime.xsd:
<xs:schema targetNamespace="urn:a:aaa" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:a="urn:a:aaa" >
 <xs:include schemaLocation="a.xsd"/>
 <xs:element name="y" type="xs:int"/>
 <xs:element name="x" type="xs:int"/>
</xs:schema>

<xs:schema targetNamespace="urn:b:bbb" 
  xmlns:a="urn:a:aaa" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:import namespace="urn:a:aaa" schemaLocation="aprime.xsd"/>
  <xs:complexType name="Derived">
    <xs:complexContent>
      <xs:restriction base="a:Base" >
        <xs:sequence>
          <xs:element ref="a:x" />
          <xs:element ref="a:y" minOccurs="1" />
        </xs:sequence>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>

As long as the local element decls you want to appropriate don't have
anonymous type definitions, such a move is always possible.

The one change being considered for version 1.1 which would make this
work no matter what, without requiring the intervening stub, is the
move from local declaration within content models to local declaration
within types.  Combined with UCDs, this would allow something like
this:

a.xsd:
<xs:schema targetNamespace="urn:a:aaa" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:a="urn:a:aaa" >
  <xs:complexType name="Base" >
      <xs:element name="x" type="xs:int" form="qualified" />
      <xs:element name="y" type="xs:int" form="qualified"/>
    <xs:sequence>
      <xs:element ref="x" />
      <xs:element ref="y" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="BE" type="a:Base" />
</xs:schema>
 
<xs:schema targetNamespace="urn:b:bbb" 
  xmlns:a="urn:a:aaa" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:import namespace="urn:a:aaa" schemaLocation="a.xsd"/>
  <xs:complexType name="Derived">
    <xs:complexContent>
      <xs:restriction base="a:Base" 
                      xmlns:aBase="a.xsd#xsucd(ct::a:Base)">
        <xs:sequence>
          <xs:element ref="aBase:x" />
          <xs:element name="aBase:y" minOccurs="1" />
        </xs:sequence>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>

I actually rather like the idea of treating complex type definitions
as namespaces within which the names of their local element
declarations sit.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, 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/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Thursday, 5 December 2002 04:51:38 UTC