[xml] Schema validation failing for xs:all element



I have a schema which has an xs:all construct. XML files written
against this validate at libxml2 2.6.11, but not at 2.6.12/13. The
validation fails in 2.6.12/13 with the error:

Schemas validity error : Element 'x:a' [CT local]: The element
content is not valid.

A minimal schema/XML file pair illustrating the problem is below -
using 'xmllint --schema test.xsd test.xml' illustrates teh error
message. I think the problem is related to namespaces, because the XML
validates against the schema if the targetNamespace attribute is
removed (and the namespace declaration/prefixes removed from the
elements in the XML)

Is this a bug in libxml2 or am I doing something wrong? (My money's on
a bug, as the XML validates against the schema with XMLSpy, MSXML,
System.XML in .Net and Xalan :-)

Stuart Dootson

---------- test.xsd ----------

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:x="http://www.wib-wib-wib.com/blah";
          targetNamespace="http://www.wib-wib-wib.com/blah";
          xmlns:xs="http://www.w3.org/2001/XMLSchema";
          elementFormDefault="qualified"
          attributeFormDefault="unqualified">

 <xs:element name="a">
   <xs:complexType>
     <xs:all>
       <xs:element name="b" type="xs:string"/>
       <xs:element name="c" type="xs:string"/>
       <xs:element name="d" type="xs:string"/>
     </xs:all>
   </xs:complexType>
 </xs:element>

</xs:schema>
---------- End of test.xsd ----------
---------- test.xml ----------

<?xml version="1.0" encoding="UTF-8"?>
<x:a xmlns:x="http://www.wib-wib-wib.com/blah";>
  <x:c>Test 1</x:c>
  <x:d>Test 1</x:d>
  <x:b>Test 1</x:b>
</x:a>

---------- End of test.xml ----------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]