[ 
https://issues.apache.org/jira/browse/XERCESC-1975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13551226#comment-13551226
 ] 

Alberto Massari commented on XERCESC-1975:
------------------------------------------

Yes, the exception is expected, and handled: the 
UnionDatatypeValidator::checkContent attempts to validate the incoming data 
with every child validator, and stops when one of them accepts it. If all of 
them throw a validation error, then a different exception 
(VALUE_no_match_memberType) is thrown.

                
> InvalidDatatypeValueException thrown when parsing a UnionDataType
> -----------------------------------------------------------------
>
>                 Key: XERCESC-1975
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1975
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 3.1.1
>            Reporter: Ashish Singhal
>            Priority: Blocker
>         Attachments: TestDoc.xml, TestSchema.xsd
>
>
> InvalidDatatypeValueException is thrown when parsing an XML document that 
> contains a Union data type and the union is contains another simple data 
> type, eg:
> Given this schema:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>       <xs:element name="TestDoc">
>               <xs:complexType>
>                       <xs:sequence>
>                               <xs:element name="SomeElement"/>
>                       </xs:sequence>
>                       <xs:attribute name="testAttribute" type="SubString"/>
>               </xs:complexType>
>       </xs:element>
>       <xs:simpleType name="SubPattern">
>               <xs:restriction base="xs:string">
>                       <xs:pattern value=".*\{.*\}.*"/>
>               </xs:restriction>
>       </xs:simpleType>
>       <xs:simpleType name="SubString">
>               <xs:union memberTypes="SubPattern xs:string"/>
>       </xs:simpleType>
> </xs:schema>
> This XML should be valid:
> <?xml version="1.0" encoding="UTF-8"?>
> <TestDoc xsi:noNamespaceSchemaLocation="TestSchema.xsd" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> testAttribute="true"
> >
> <SomeElement/>
> </TestDoc>
> However an InvalidDatatypeValueException is thrown when validating this 
> document.
> Changing my schema to remove SubPattern from the SubString union, fixes the 
> issue, but it's not the solution I'm looking for. 
> I would like xerces-c to validate the document correctly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to