Good day,

I am writing a small XML Schema validation benchmark (so far libxml2 kicks
ass of all general-purpose validating XML parsers for C/C++ that I could
get my hand on) and stumbled upon this bug in libxml2 2.6.26 (Debian
unstable). The attached test.xml, when parsed and validated with libxml2,
results in the following error:

Schemas validity error : Element 
'{http://www.codesynthesis.com/xmlns/xsdbench/structure}peach': This element is 
not expected. Expected is one of ( 
{http://www.codesynthesis.com/xmlns/xsdbench/structure}apple, 
{http://www.codesynthesis.com/xmlns/xsdbench/structure}orange, 
{http://www.codesynthesis.com/xmlns/xsdbench/structure}mango ).

hth,
-boris


-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open Source Cross-Platform C++ XML Data Binding
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema";
        xmlns:s="http://www.codesynthesis.com/xmlns/xsdbench/structure";
        targetNamespace="http://www.codesynthesis.com/xmlns/xsdbench/structure";
        elementFormDefault="qualified">
        
  <complexType name="Base">
    <sequence minOccurs="0" maxOccurs="unbounded">
      <element name="apple" type="string" minOccurs="0" maxOccurs="1"/>
      <element name="orange" type="string" minOccurs="0" maxOccurs="unbounded"/>
      <element name="mango" type="string" minOccurs="1" maxOccurs="1"/>
      <element name="grapefruit" type="string" minOccurs="1" 
maxOccurs="unbounded"/>
    </sequence>
  </complexType>

  <complexType name="Extension">
    <complexContent>
      <extension base="s:Base">
        <choice minOccurs="0" maxOccurs="unbounded">
          <element name="peach" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="apricot" type="string" minOccurs="0" 
maxOccurs="unbounded"/>
          <element name="tangerine" type="string" minOccurs="1" maxOccurs="1"/>
          <element name="banana" type="string" minOccurs="1" 
maxOccurs="unbounded"/>
        </choice>
      </extension>
    </complexContent>
  </complexType>

  <element name="structure">
    <complexType>
      <sequence>
        <element name="extension" type="s:Extension" maxOccurs="unbounded"/>
      </sequence>
    </complexType>
  </element>    
</schema>

Attachment: test.xml
Description: application/xml

Attachment: signature.asc
Description: Digital signature

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to