Hi, On Mon, 2006-02-20 at 20:40 +1000, Bas Driessen wrote: > On Mon, 2006-02-20 at 03:39 -0500, Daniel Veillard wrote: > > On Mon, Feb 20, 2006 at 01:29:32PM +1000, Bas Driessen wrote: > > > Hello, > > > > > > 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"> > > > <Boolean1>true</Boolean1> > > > <Boolean2>xtrue</Boolean2> > > > <Boolean3> true </Boolean3> > > > <Boolean4/> > > > </TestRoot> > > > > > > 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:complexType> > > > <xs:sequence> > > > <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"/> > > > </xs:sequence> > > > </xs:complexType> > > > </xs:element> > > > </xs:schema> > > > > > > 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. > > > > http://www.w3.org/TR/xmlschema-2/#boolean > > > > 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. > > Thanks for that Daniel. Yes, just confirmed that the values 0 and 1 > validate OK while any other numeric value like (2,3,-0,-1 etc) fail as > expected, so no issues there. > Will wait for comments from Kasimier.
Daniel is right about the issue. I'll look into why <Boolean4/> is accepted and keep you informed here on the list. As a side-effect, I realized that schema acquisition via XSI is broken in 2.6.23. The namespace resolution mechanism is broken is some cases and the components cannot be aquired. I'll have a deeper look into this when I have some time. We are in need of some regression tests using XSI schema acquisition. Regards, Kasimier _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
