Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.1.1
-
None
-
None
Description
if i parse the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<State>
<testsub>123456</testsub>
<testsub2>123456</testsub2>
</State>
with the XSD:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="State" type="StateType" />
<xsd:complexType name="StateType">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="testsub" type="xsd:nonNegativeInteger"/>
<xsd:element minOccurs="0" maxOccurs="0" name="testsub2" type="xsd:nonNegativeInteger"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
An error is generated:
Message: element 'testsub2' is not allowed for content model
whereas the XSD:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="State" type="StateType" />
<xsd:complexType name="StateType">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="0" name="testsub" type="xsd:nonNegativeInteger"/>
<xsd:element minOccurs="0" maxOccurs="1" name="testsub2" type="xsd:nonNegativeInteger"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
does not generate an error
NB: xerces 2.7 doe never generates an error
this is easilly reproduced with the sample code in xerces-c-3.1.1/samples/src/PParse