Processing of not-declared-element with "xsi:type" under anyType element does
not clear SchemaValidator::fXsiType
-----------------------------------------------------------------------------------------------------------------
Key: XERCESC-1707
URL: https://issues.apache.org/jira/browse/XERCESC-1707
Project: Xerces-C++
Issue Type: Bug
Components: Validating Parser (Schema) (Xerces 1.5 or up only)
Affects Versions: 2.6.0, 2.7.0
Reporter: Alexey Miroshnichenko
input.xml
=================
<?xml version="1.0" encoding="UTF-8"?>
<purchaseOrder xmlns="http://www.openuri.org/mySchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openuri.org/mySchema xsd.xsd">
<shipTo>
<name>ship-to-name</name>
<element_of_any_type>
<unknown_element xsi:type="USState">AK</unknown_element>
</element_of_any_type>
</shipTo>
<billTo>
<name>bill-to-name</name>
<element_of_any_type/>
</billTo>
</purchaseOrder>
=================
xsd.xsd
=================
<?xml version="1.0"?>
<xsd:schema xmlns="http://www.openuri.org/mySchema"
elementFormDefault="qualified"
targetNamespace="http://www.openuri.org/mySchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<xsd:element name="purchaseOrder" type="PurchaseOrderType" />
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:element name="shipTo" type="USAddress" />
<xsd:element name="billTo" type="USAddress" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="USAddress">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="element_of_any_type"/>
</xsd:sequence>
<!-- declaration of this attribute is necesary to reproduce -->
<xsd:attribute fixed="US" name="country" type="xsd:NMTOKEN" />
</xsd:complexType>
<xsd:simpleType name="USState">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AK"/>
<xsd:enumeration value="AL"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
=================
Validation of input.xml reports follow error:
Error at file input.xml, line 11, char 10
Message: Type 'USState' that is used in xsi:type is not derived from the type
of element 'billTo'
reason for this behavior is that SchemaValidator::fXsiType is not cleared after
element "unknown_element" processing.
--
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]