This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2244 - R-252: Final/block, transitivity and restriction
Summary: R-252: Final/block, transitivity and restriction
Status: CLOSED WONTFIX
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: unspecified
Hardware: All All
: P4 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard: medium, hard, restriction cluster
Keywords: resolved
Depends on:
Blocks:
 
Reported: 2005-09-14 19:43 UTC by Sandy Gao
Modified: 2009-04-21 19:21 UTC (History)
0 users

See Also:


Attachments

Description Sandy Gao 2005-09-14 19:43:20 UTC
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
Comment 1 C. M. Sperberg-McQueen 2006-12-22 17:02:23 UTC
The WG agreed that the type RestrictOKorNot is not legal, and that it
should not be.  The chain of derivation from bottom to top has some
non-restriction steps, and that means it should not be OK to
substitute bottom for top in the restriction.

The WG decided to make no change here.  The originator of the
comment, Henry Thompson, agrees.