W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2000

Redefine - composition of multiple <redefine>s and ordering of <redefine> interpretation

From: Bob Schloss <rschloss@us.ibm.com>
Date: Thu, 21 Dec 2000 17:08:31 -0500
To: www-xml-schema-comments@w3.org
Message-ID: <OFAF1E627C.7DD9869A-ON852569BC.0075E6AF@pok.ibm.com>
I would like to see additional constraints apply
to <redefine> or some kind of flow-chart or pseudo-code
which could clarify how processor implement this.

This note shows two areas where I think the current
specification is under-specified.


Here is my first concern: a single redefineable
changed more than once in a single <xs:redefine>
element information item, or changed more than once
in more than one <xs:redefine> element information
items which occur in the same file.

Let us consider a single schema document,
v2.xsd, containing the following:

<xs:schema ....>
...

<xs:redefine schemaLocation="http://v1.xsd">
   <xs:simpleType name="age">
     <xs:restriction base="age">
       <xs:maxInclusive value="90">
     </xs:restriction>
   </xs:simpleType>
   <xs:complexType name="personName">
     <xs:complexContent>
        <xs:extension base="personName">
          <xs:sequence>
             <xs:element name="generation" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
     </xs:complexContent>
   </xs:complexType>
</xs:redefine>

<xs:redefine schemaLocation="http://v1.xsd">
   <xs:simpleType name="age">
     <xs:restriction base="age">
       <xs:maxInclusive value="91">
     </xs:restriction>
   </xs:simpleType>
   <xs:complexType name="personName">
     <xs:complexContent>
        <xs:extension base="personName">
          <xs:sequence>
             <xs:element name="suffix" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
     </xs:complexContent>
   </xs:complexType>
</xs:redefine>
...
</xs:schema>

One could argue that any of these interpretations should
be taken by a conforming processor:

a) The entire schema v2.xsd is not valid because there
   is an error in the second redefine
   (i.e. enlarging the value space in a restriction, by
   changing the max from 90 to 91)
b) The schema v2 must ignore all definitions
   from the second redefine, because it contains an error
c) The schema v2 has the following effective definitions
   of types:
     simpleType "age" with maxInclusive "90"
     complexType personName with last 2 particles
            generation
            suffix
     in that order

Please say which interpretation is to apply.



My second concern is the possibility of different
processors which process <include> <import>
and <redefine>s in different orders,
especially when there a multiple schema documents
being stitched together. (Perhaps one processor
builds schema components in a depth-first load and parse
of all xsd files, while another processor builds schema
components in a breadth-first load and parse
of all xsd files).

Let us suppose that outer.xsd has
<include schemaLocation="v2a.xsd">
<include schemaLocation="v2b.xsd">
<xs:redefine schemaLocation="http://v1.xsd">
   <xs:complexType name="personName">
     <xs:complexContent>
        <xs:extension base="personName">
          <xs:sequence>
             <xs:element name="tribe" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
     </xs:complexContent>
   </xs:complexType>
</xs:redefine>

and v2a.xsd has:
<include schemaLocation="v3a.xsd">

and v2b.xsd has:
<xs:redefine schemaLocation="http://v1.xsd">
   <xs:complexType name="personName">
     <xs:complexContent>
        <xs:extension base="personName">
          <xs:sequence>
             <xs:element name="suffix" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
     </xs:complexContent>
   </xs:complexType>
</xs:redefine>

and v3a.xsd has:
<xs:redefine schemaLocation="http://v1.xsd">
   <xs:complexType name="personName">
     <xs:complexContent>
        <xs:extension base="personName">
          <xs:sequence>
             <xs:element name="generation" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
     </xs:complexContent>
   </xs:complexType>
</xs:redefine>


One could argue that a conforming processor thinks
the effective definition of type personName is a
sequence of
   some particles from v1.xsd's definition of personName
    followed by:
a) tribe, followed by suffix, followed by generation OR
b) suffix, followed by tribe, followed by generation OR
c) generation, followed by tribe, followed by suffix OR
d) tribe, followed by generation, followed by suffix OR
e) suffix, followed by generation, followed by tribe OR
f) generation, followed by suffix, followed by tribe OR

Unless all conforming processors would
get the same definition, this is not good for interoperability.



Thank you,
Bob Schloss
IBM Thomas J. Watson Research Center
Hawthorne, New York, USA
Received on Thursday, 21 December 2000 17:09:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT