Whitespace processing in union of token and string based simple types
---------------------------------------------------------------------

                 Key: XERCESJ-1446
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1446
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.0 Datatypes
    Affects Versions: 2.9.1
         Environment: OS: Win XP SP2
SW: Eclipse platform running Oxygen XML plugin with default validation engine 
Xerces-J 2.9.1
            Reporter: Karthik Sankaran
            Priority: Minor


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...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to