Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Cannot Reproduce
-
3.1.1
-
None
-
None
Description
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.