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 2233 - R-241: Question re: Validation of an element restriction whose base type has the variety union
Summary: R-241: Question re: Validation of an element restriction whose base type has ...
Status: CLOSED FIXED
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: All All
: P4 normal
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords: resolved
Depends on:
Blocks:
 
Reported: 2005-09-14 19:34 UTC by Sandy Gao
Modified: 2009-04-21 19:21 UTC (History)
0 users

See Also:


Attachments

Description Sandy Gao 2005-09-14 19:34:45 UTC
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.
Comment 2 C. M. Sperberg-McQueen 2006-09-23 22:46:52 UTC
The problem identified here is the same as the one mentioned in
bug 2333; it has been addressed in XML Schema 1.1 by eliminating 
the practice of 'flattening' union, thus ensuring that when a
union is restricted, its union-level facets are not lost when
it is named as a member of another union.  The same change addresses
the problem identified here, in which the union-level facets are lost
when restriction is checked.  Under the new rules, the restriction
of ct-base by ct-deriv is not legal, since the type assigned to
element e in ct-deriv is not a restriction of the type assigned
to that element in ct-base.

The original comment still applies to XML Schema 1.0, and I have
made a separate issue for 1.0 (bug 3763).

With the change to the treatment of unions, which is reflected in
the current published working draft, I believe this issue has been
resolved, so I am changing its status to RESOLVED / FIXED.
Comment 3 C. M. Sperberg-McQueen 2006-09-23 23:09:23 UTC
For the record:  a response has been sent to Michael Marchegay, who
originally raised this issue (on xmlschema-dev) and to Alessandro
Triglia, who seconded the point and forwarded the mail to 
the schema comments list.  A copy of the response may be found
in the archive of the XML Schema comments list
http://lists.w3.org/Archives/Public/www-xml-schema-comments/2006JulSep/0157.html