Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1066

Restriction+choice+substitutionGroup error

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.2
    • Fix Version/s: 2.9.0
    • Labels:
      None
    • Environment:
      N/A

      Description

      When using a substitution group head in a choice, the head of the substitition group is not correctly treated as a choice.

      Given a choice of X and Y where X is the head of a group with the members X1, X2 and X3, the following SHOULD be true:

      Base = (X|Y)*

      ...according to clause 2.1 of Schema Component Constraint: Particle Valid (Restriction) <http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict> this should be interpreted as:

      Base = ((X|X1|X2|X3)|Y)*

      Therefore the following should be a valid restriction, but Xerces does not allow it:

      Restriction = ((X1|X2)|Y)*

      I am aware that some simplification of the choices is required by clause 2.2 of the above section, but this should not have the effect that it is.

      The following schema document demonstrates this:
      -----------------------------------------
      <?xml version="1.0"?>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      targetNamespace="urn:restrict" xmlns="urn:restrict"
      elementFormDefault="qualified"
      attributeFormDefault="unqualified">

      <xsd:complexType name="base">
      <xsd:complexContent>
      <xsd:restriction base="xsd:anyType">
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
      <xsd:element ref="X"/>
      <xsd:element ref="Y"/>
      </xsd:choice>
      </xsd:restriction>
      </xsd:complexContent>
      </xsd:complexType>
      <xsd:element name="X"/>
      <xsd:element name="Y"/>
      <xsd:complexType name="restriction">
      <xsd:complexContent>
      <xsd:restriction base="base">
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
      <xsd:choice>
      <xsd:element ref="X1"/>
      <xsd:element ref="X2"/>
      </xsd:choice>
      <xsd:element ref="Y"/>
      </xsd:choice>
      </xsd:restriction>
      </xsd:complexContent>
      </xsd:complexType>
      <xsd:element name="X1" substitutionGroup="X"/>
      <xsd:element name="X2" substitutionGroup="X"/>

      </xsd:schema>

        Attachments

        1. patch3.txt
          11 kB
          Ignacio Hernandez-Ros
        2. bug1066-case3.xsd
          1.0 kB
          Ignacio Hernandez-Ros
        3. bug1066-case0.xsd
          1 kB
          Ignacio Hernandez-Ros
        4. bug1066-case1.xsd
          0.8 kB
          Ignacio Hernandez-Ros
        5. bug1066-case2.xsd
          0.8 kB
          Ignacio Hernandez-Ros
        6. patch2-2.txt
          6 kB
          Ignacio Hernandez-Ros
        7. patch1.txt
          0.9 kB
          Ignacio Hernandez-Ros
        8. patch2.txt
          6 kB
          Ignacio Hernandez-Ros

          Activity

            People

            • Assignee:
              sandygao@ca.ibm.com Sandy Gao
              Reporter:
              emptyweevil Martin Thomson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: