[lxml-dev] greetings, and another bug...
Jim Rees
jimrees at itasoftware.com
Wed Apr 11 01:05:47 CEST 2007
Itamar told me I'd get best results by joining this list.
First off lxml.etree is great. I'm relatively new to both Python
and XML, and this is the only way to code XML stuff.
I have found a few bugs, the first set of which Itamar may have
already forwarded along. Today I found another. A valid XSD
construct fails to validate. (Not the document to be validated, but
the schema doc itself). If the minInclusive/maxInclusive facets are
removed, the problem goes away. xmllint running against the same
libxml2 shlibs has no problem with this.
This has been consistent across 1.1.2, 1.2.1, and 1.3.beta.
import lxml.etree as ET
import sys
trivial_schema = """<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="typePercentage">
<xsd:restriction base="xsd:decimal">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="Percentage" type="typePercentage"/>
</xsd:schema>
"""
schematree = ET.XML(trivial_schema)
validator = ET.XMLSchema(schematree)
trivial_document = """<?xml version="1.0" encoding="UTF-8"?>
<Percentage>99.99999999999999999999</Percentage>
"""
doctree = ET.XML(trivial_document)
validator.assertValid(doctree)
print "Okay."
More information about the lxml-dev
mailing list