[xml] XSD Schema validation issues with boolean type.


I am using the latest version of libxml2 (2.6.23) and have an issue with validation boolean type fields using "xmllint --schema". If I have an XML file as follows:

<TestRoot xmlns="urn:Test-schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:Test-schema Test.xsd">
  <Boolean3>   true   </Boolean3>

My understanding is that only Boolean1 should validate OK and the other 3 cases should fail. My test.xsd is as follows:

<xs:schema xmlns="urn:Test-schema" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="Test" version="1" targetNamespace="urn:Test-schema" elementFormDefault="qualified">
<!-- Root -->
  <xs:element name="TestRoot">
        <xs:element name="Boolean1" type="xs:boolean"/>
        <xs:element name="Boolean2" type="xs:boolean"/>
        <xs:element name="Boolean3" type="xs:boolean"/>
        <xs:element name="Boolean4" type="xs:boolean"/>

The output of xmllint however is as follows:

test.xml:4: element Boolean2: Schemas validity error : Element '{urn:Test-schema}Boolean2': 'xtrue' is not a valid value of the atomic type 'xs:boolean'.
test.xml fails to validate

So it only picks up the problem in situation 2, while situation 3 and 4 is not being picked up as a problem.

Is this is problem/issue in libxml2 or am I overlooking something? I have been visiting the mail archives and FAQs etc and I realize that XML Schemas is not fully implemented/finished yet, so perhaps this is still to come?

The output of xmllint --version as follows:

xmllint: using libxml version 20623
compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug

Any response in this is appreciated.


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