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

Whitespace processing in union of token and string based simple types

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9.1
    • Fix Version/s: 2.10.0
    • Environment:
      OS: Win XP SP2
      SW: Eclipse platform running Oxygen XML plugin with default validation engine Xerces-J 2.9.1

      Description

      1. "DressSizeType" is a xs:token based simple type with enumerated values "small" and "large":

      <xs:simpleType name="DressSizeType">
      <xs:restriction base="xs:token">
      <xs:enumeration value="small"/>
      <xs:enumeration value="large"/>
      </xs:restriction>
      </xs:simpleType>

      2. "MDressSizeType" is a union type with the above "DressSizeType" as one of its member types and the other being a string based simple type:

      <xs:simpleType name="MDressSizeType">
      <xs:union memberTypes="DressSizeType">
      <xs:simpleType>
      <xs:restriction base="xs:string">
      <xs:enumeration value="medium"/>
      </xs:restriction>
      </xs:simpleType>
      </xs:union>
      </xs:simpleType>

      "MDressSizeType" is introduced mainly to add another enumeration value "medium" to the already existing "small" and "large" enumeration values.

      3. An element "dressSize" is assigned the type "MDressSizeType"

      4. "dressSize.xsd" is created from 1, 2, and 3. It looks like:

      <?xml version="1.0" encoding="UTF-8"?>

      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:simpleType name="DressSizeType">
      <xs:restriction base="xs:token">
      <xs:enumeration value="small"/>
      <xs:enumeration value="large"/>
      </xs:restriction>
      </xs:simpleType>

      <xs:simpleType name="MDressSizeType">
      <xs:union memberTypes="DressSizeType">
      <xs:simpleType>
      <xs:restriction base="xs:string">
      <xs:enumeration value="medium"/>
      </xs:restriction>
      </xs:simpleType>
      </xs:union>
      </xs:simpleType>

      <xs:element name="dressSize" type="MDressSizeType"></xs:element>

      </xs:schema>

      5. "dressSize.xml" is created and it looks like:
      <?xml version="1.0" encoding="UTF-8"?>
      <dressSize xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="dressSize.xsd"> medium </dressSize>

      6. When 5 is validated, the value ' medium ' (with leading and trailing white-spaces) for the "dressSize" element was expected to be invalid as the enumeration "medium" is encapsulated within a string based simple type whose whitespace facet value is preserve.

      7. But the validation engine accepts the value ' medium ' for "dressSize" element and informs that the document is valid.

      Kindly note: I have made the best possible attempt to scan all the other reported bugs under this component to avoid a duplicate entry. Apologies in case I missed out to spot it.

      Thanks very much in advance! Appreciate all your efforts...

        Attachments

        1. dressSize.zip
          0.6 kB
          Karthik Sankaran

          Activity

            People

            • Assignee:
              mrglavas@ca.ibm.com Michael Glavassevich
              Reporter:
              karthik.sankaran Karthik Sankaran
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: