You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Jim Puccio <ch...@earthlink.net> on 2000/10/20 11:59:50 UTC
Bug in Schema validator
I've localized a bug from a large recursive schema into the following test
case. I'm sure you will find it interesting. If the test is run through
Xerces 1.2.0 in the form given, it will complain that the content of element
type "buggy" must match "((buggy|##any),removeMe+)", which it plainly does.
On the other hand, if you comment out the <removeMe/> tag and its associated
line in the schema, everything is hunky-dory. Similarly, if you move the
<removeMe/> tag before the <anything/>, and make the corresponding
adjustment in the schema, it also validates properly. BTW, I'm using the
DOM Parser.
Here's the XML file:
<?xml version="1.0" encoding="UTF-8"?>
<outer
xmlns:xsi = "http://www.w3.org/1999/XMLSchema-instance"
xsi:noNamespaceSchemaLocation = "bug.xsd">
<buggy> <anything/> <removeMe/> </buggy>
</outer>
And here's its schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
xmlns:xsd = "http://www.w3.org/1999/XMLSchema"
xmlns:xsi = "http://www.w3.org/1999/XMLSchema-instance">
<xsd:element name = "outer">
<xsd:complexType content = "elementOnly">
<xsd:group ref = "choices"/>
</xsd:complexType>
</xsd:element>
<xsd:group name = "choices">
<xsd:choice>
<xsd:element ref = "buggy"/>
<xsd:any processContents = "lax"/>
</xsd:choice>
</xsd:group>
<xsd:element name = "buggy">
<xsd:complexType content = "elementOnly">
<xsd:sequence>
<xsd:group ref = "choices"/>
<xsd:element name = "removeMe" maxOccurs = "unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
-- Jim Puccio