You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Morgan Parry (JIRA)" <xe...@xml.apache.org> on 2013/01/11 17:12:12 UTC

[jira] [Commented] (XERCESC-1975) InvalidDatatypeValueException thrown when parsing a UnionDataType

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

Morgan Parry commented on XERCESC-1975:
---------------------------------------

I hope it's correct to comment on this existing bug rather than opening a fresh one and that you will receive notification.

I am seeing this bug exactly as described, both when using the Xerces 3.1.1 DLL via our own software or if I use the supplied sax2print utility. The sample files that are already attached to this are sufficient, though I originally encountered the issue with our own data.

My steps:
- Downloaded the current xerces-c-3.1.1-x86_64-windows-vc-10.0.zip distribution from http://xerces.apache.org.
- Ran 'sax2print.exe TestDoc.xml' under the Visual Studio 2012 debugger with 'C++ Exceptions' ticked under Debug -> Exceptions...
- Observed the xercesc_3_1::InvalidDatatypeValueException being thrown.

Please note that the document does still appear to be validated correctly afterwards in my tests. However, the problem is that the exception is thrown at all as there are no issues with the XML or XSD files.

Within our own software we see this callstack when the exception is thrown:

xercesc_3_1::AbstractStringValidator::checkContent() Line 636	C++
xercesc_3_1::AbstractStringValidator::validate() Line 553	C++
xercesc_3_1::UnionDatatypeValidator::checkContent() Line 258	C++
xercesc_3_1::UnionDatatypeValidator::validate() Line 232	C++
xercesc_3_1::SchemaValidator::checkContent() Line 259	C++
xercesc_3_1::IGXMLScanner::scanEndTag() Line 1082	C++
xercesc_3_1::IGXMLScanner::scanContent() Line 882	C++
xercesc_3_1::IGXMLScanner::scanDocument() Line 217	C++
xercesc_3_1::SAX2XMLReaderImpl::parse() Line 409	C++

The exception code is XMLExcepts::VALUE_NotIn_Enumeration.

Is this intended behaviour?
                
> 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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org