[lxml-dev] objectify parses 't' and 'f' as BoolElement?

jholg at gmx.de jholg at gmx.de
Tue Jun 16 16:41:09 CEST 2009


Hi,

somewhere on the way between lxml 2.0 and 2.1.5 objectify changed to
accept 't' and 'f' as values recognized as BoolElements:

2.0.alpha4:
0 $ python2.4 -i -c 'from lxml import etree, objectify;  objectify.enableRecursiveStr(); print etree.__version__; print etree.LIBXML_VERSION, etree.LIBXSLT_VERSION'
2.0.alpha4
(2, 6, 27) (1, 1, 20)
>>> root = objectify.fromstring('<root><bool>f</bool></root>')
>>> print root
root = None [ObjectifiedElement]
    bool = 'f' [StringElement]
>>> root.bool.text
'f'

2.1.5:
0 $ python2.4 -i -c 'from lxml import etree, objectify; objectify.enable_recursive_str(); print etree.__version__; print etree.LIBXML_VERSION, etree.LIBXSLT_VERSION'
2.1.5
(2, 6, 32) (1, 1, 23)
>>> root = objectify.fromstring('<root><bool>f</bool></root>')
>>> print root
root = None [ObjectifiedElement]
    bool = False [BoolElement]


I consider this a bug, XML Schema datatypes spec says
"
3.2.2 boolean

[Definition:]  boolean has the ·value space· required to support the mathematical concept of binary-valued logic: {true, false}.

3.2.2.1 Lexical representation

An instance of a datatype that is defined as ·boolean· can have the following legal literals {true, false, 1, 0}. 
...
"

Objections to restricting this to said literals, again?

Holger
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


More information about the lxml-dev mailing list