[lxml-dev] lxml.objectify.deannotate refuses to clean nil nodes
Robert Pierce
robert at smithpierce.net
Mon Jun 1 18:21:01 CEST 2009
The nil node <Fubar/> is not deannotated as I would expect in the following
snippet. I could not find a reference to this behaviour in the archives or
documentation. Is this a design feature for which there is a work around,
or a bug? I'm using lxml-2.2-py2.5-linux-i686.
Thanks!
#### CODE ####
import lxml.etree
import lxml.objectify
x = lxml.objectify.fromstring('<root><Bar/></root>')
x.Foo = ''
x.Fubar = None
lxml.objectify.deannotate(x)
lxml.etree.cleanup_namespaces(x)
print lxml.etree.tostring(x)
#### END CODE ###
<root><Bar/><Foo></Foo><Fubar xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/></root>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/lxml-dev/attachments/20090601/dc229dde/attachment.htm
More information about the lxml-dev
mailing list