16 May 14:20
bug: objectify removes text on replace()?
From: Christian Zagrodnick <cz <at> gocept.com>
Subject: bug: objectify removes text on replace()?
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-16 12:21:27 GMT
Subject: bug: objectify removes text on replace()?
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-16 12:21:27 GMT
Hi,
with lxml 2.0.4 I get text removed when I replace a node. The text
after the replaced node vanishes....
-----------------------
import lxml.objectify
import lxml.etree
xml = lxml.objectify.fromstring(
'<foo><bar>before baz<baz/>after baz</bar><bar/></foo>')
print lxml.etree.tostring(xml, pretty_print=True)
print 50*'-'
baz = xml['bar']['baz']
xml['bar'].replace(baz, lxml.objectify.E.holler())
print lxml.etree.tostring(xml, pretty_print=True)
-----------------
Prints out:
<foo>
<bar>before baz<baz/>after baz</bar>
<bar/>
</foo>
--------------------------------------------------
<foo>
<bar>before baz<holler
(Continue reading)
RSS Feed