Final/block, transitivity and restriction

In certain cases, I'm not sure the current REC makes the right call on
when to do recursive checking up the base type chain and when not.

Consider the following schema document:

<xs:schema>
 <xs:element name="root" type="top"/>
 
 <xs:complexType name="top" final="restriction">
  <xs:sequence>
   <xs:element name="a" minOccurs="0"/>
  </xs:sequence>
 </xs:complexType>
 
 <xs:complexType name="intermediate">
  <xs:complexContent>
   <xs:extension base="top">
    <xs:sequence>
     <xs:element name="b"/>
    </xs:sequence>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 
 <xs:complexType name="bottom">
  <xs:complexContent>
   <xs:restriction base="intermediate">
    <xs:sequence>
     <xs:element name="b"/>
    </xs:sequence>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>
 
 <xs:complexType name="top2">
  <xs:sequence>
   <xs:element name="c" type="top"/>
  </xs:sequence>
 </xs:complexType>
 
 <xs:complexType name="restrictOKorNot">
  <xs:complexContent>
   <xs:restriction base="top2">
    <xs:sequence>
     <xs:element name="c" type="bottom"/>
    </xs:sequence>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>
</xs:schema>

The constraints on type definitions do _not_ recurse up the chain when
checking 'final', so the type def named 'bottom' above is OK, despite
restricting away an element ('a') introduced in a type definition
which says it's final for restriction.

However, content model checking _does_ recurse up the chain, so the
type defn named 'restrictOKorNot' is _not_ OK.  Neither is that
following instance, wrt the schema corresponding to the above schema
doc:

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:type="bottom">
 <b/>
</root>

Is this really what we want?

ht
-- 
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@inf.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 Friday, 26 March 2004 13:04:53 UTC