[Bug 2244] R-252: Final/block, transitivity and restriction

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2244

           Summary: R-252: Final/block, transitivity and restriction
           Product: XML Schema
           Version: 1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSD Part 1: Structures
        AssignedTo: ht@w3.org
        ReportedBy: sandygao@ca.ibm.com
         QAContact: www-xml-schema-comments@w3.org


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? 

See
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2004JanMar/0087.html

Received on Wednesday, 14 September 2005 19:43:35 UTC