[Bug 2233] R-241: Question re: Validation of an element restriction whose base type has the variety union

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

           Summary: R-241: Question re: Validation of an element restriction
                    whose base type has the variety union
           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


It seems to me that the the following schema should be invalid because the 
value space of the base type definition of the element "e" in the type "ct-
base" is not a super set of the value space of the base type definition of the 
element "e" in "ct-deriv"; but I cannot find any Schema Component Constraint 
invalidating it. 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:simpleType name="base">
    <xs:union memberTypes="xs:boolean xs:integer"/>
  </xs:simpleType>

  <xs:simpleType name="deriv">
    <xs:restriction base="base">
      <xs:enumeration value="1"/>
      <xs:enumeration value="2"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="ct-base">
    <xs:sequence>
      <xs:element name="e" type="deriv"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ct-deriv">
    <xs:complexContent>
      <xs:restriction base="ct-base">
        <xs:sequence>
          <xs:element name="e" type="xs:integer"/>
        </xs:sequence>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

</xs:schema>

Using cos-st-derived-ok [1], xs:integer seems to be validly derived given 
{extension, list, union} from deriv (because the member type definitions 
property of deriv is the the member type definitions of base). Therefore, 
rcase_NameAntTypeOK [2] is not violated, and the restriction seems to be valid. 

Comment originally posted to xmlschema-dev mail list.

Received on Wednesday, 14 September 2005 19:34:55 UTC