Re: [xml] XSD Schema validation issues with boolean type.

On Mon, Feb 20, 2006 at 01:29:32PM +1000, Bas Driessen wrote:

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"
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=""; 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.

there is a 'whiteSpace' constraining facet, so I think Boolean3 might validate
For Boolean4 this looks like a bug to me. Also note that '1' and '0' are 
accepted values for this type. 
Kasimier certainly has a more precise idea about this. I'm surprized this
kind of problem isn't caught by the huge OASIS datatype regression tests.


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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