[ 
https://issues.apache.org/jira/browse/XERCESC-2115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Brian Chapman updated XERCESC-2115:
-----------------------------------
    Description: 
see: 
[https://stackoverflow.com/questions/39755370/xerces-c-xml-xsd-union-always-collapsing-whitespace]
 for longer discussion.

 I find that the problem doesn't care what I union with, or that I union with 
anything at all. So the simplest demonstration is to add these definitions to 
the above XSD.

{noformat}
  <xs:simpleType name="HellUnion">
    <xs:union memberTypes="Hello" />
  </xs:simpleType>
  <xs:element name="root2">
    <xs:complexType>
      <xs:attribute name="stuff" type="HellUnion" />
    </xs:complexType>
  </xs:element>
{noformat}

Then Xerces-C rejects this XML as not valid:

<?xml version="1.0" encoding="UTF-8" ?>
<root2 stuff="Hello World&amp;#x09;!" />
I think the error message is enlightening:

{noformat}
value 'Hello World !' does not match any member types of the union
{noformat}

Notice the space before the '!' where the tab was previously.

Microsoft .Net runtime XML/XSD system reports it as valid.

I have tried adding whitespace=preserve to the "Hello" simple type definition:

{noformat}
  <xs:simpleType name="Hello">
    <xs:restriction base="xs:string">
      <xs:whiteSpace value="preserve"/>
      <xs:pattern value="Hello World&#x09;!"/>
    </xs:restriction>
  </xs:simpleType>
{noformat}

This does not help.

  was:
see: 
[https://stackoverflow.com/questions/39755370/xerces-c-xml-xsd-union-always-collapsing-whitespace]
 for longer discussion.

 I find that the problem doesn't care what I union with, or that I union with 
anything at all. So the simplest demonstration is to add these definitions to 
the above XSD.

{noformat}
  <xs:simpleType name="HellUnion">
    <xs:union memberTypes="Hello" />
  </xs:simpleType>
  <xs:element name="root2">
    <xs:complexType>
      <xs:attribute name="stuff" type="HellUnion" />
    </xs:complexType>
  </xs:element>
{noformat}

Then Xerces-C rejects this XML as not valid:

<?xml version="1.0" encoding="UTF-8" ?>
<root2 stuff="Hello World&amp;&#x09;!" />
I think the error message is enlightening:

{noformat}
value 'Hello World !' does not match any member types of the union
{noformat}

Notice the space before the '!' where the tab was previously.

Microsoft .Net runtime XML/XSD system reports it as valid.

I have tried adding whitespace=preserve to the "Hello" simple type definition:

{noformat}
  <xs:simpleType name="Hello">
    <xs:restriction base="xs:string">
      <xs:whiteSpace value="preserve"/>
      <xs:pattern value="Hello World&#x09;!"/>
    </xs:restriction>
  </xs:simpleType>
{noformat}

This does not help.


> XSD xs:union always collapses whitespace
> ----------------------------------------
>
>                 Key: XERCESC-2115
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2115
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 3.1.4
>         Environment: Windows 7,    likely also Mac and Linux but didn't check
>            Reporter: Brian Chapman
>
> see: 
> [https://stackoverflow.com/questions/39755370/xerces-c-xml-xsd-union-always-collapsing-whitespace]
>  for longer discussion.
>  I find that the problem doesn't care what I union with, or that I union with 
> anything at all. So the simplest demonstration is to add these definitions to 
> the above XSD.
> {noformat}
>   <xs:simpleType name="HellUnion">
>     <xs:union memberTypes="Hello" />
>   </xs:simpleType>
>   <xs:element name="root2">
>     <xs:complexType>
>       <xs:attribute name="stuff" type="HellUnion" />
>     </xs:complexType>
>   </xs:element>
> {noformat}
> Then Xerces-C rejects this XML as not valid:
> <?xml version="1.0" encoding="UTF-8" ?>
> <root2 stuff="Hello World&amp;#x09;!" />
> I think the error message is enlightening:
> {noformat}
> value 'Hello World !' does not match any member types of the union
> {noformat}
> Notice the space before the '!' where the tab was previously.
> Microsoft .Net runtime XML/XSD system reports it as valid.
> I have tried adding whitespace=preserve to the "Hello" simple type definition:
> {noformat}
>   <xs:simpleType name="Hello">
>     <xs:restriction base="xs:string">
>       <xs:whiteSpace value="preserve"/>
>       <xs:pattern value="Hello World&#x09;!"/>
>     </xs:restriction>
>   </xs:simpleType>
> {noformat}
> This does not help.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to