[
https://issues.apache.org/jira/browse/XERCESJ-1446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860642#action_12860642
]
Mukul Gandhi commented on XERCESJ-1446:
---------------------------------------
I think, if you want a white-space preserving behavior for all the member types
of the union, you must change the 'DressSizeType' to following:
<xs:simpleType name="DressSizeType">
<xs:restriction base="xs:string">
<xs:enumeration value="small"/>
<xs:enumeration value="large"/>
</xs:restriction>
</xs:simpleType>
(and, I think that would solve the problem you are facing.)
This would also make, the XSD types in your schema, more consistent with each
other.
Currently, you're deriving 'DressSizeType' from xs:token, which I think, forces
a white-space collapse normalization behavior to text content -- so ' medium
' validates with an enumeration value, 'medium'.
> 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
> Attachments: dressSize.zip
>
>
> 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]