Christian Zagrodnick | 16 May 14:20

bug: objectify removes text on replace()?

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 
xmlns:py="http://codespeak.net/lxml/objectify/pytype" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/></bar>
  <bar/>
</foo>

Thanks,
--

-- 
Christian Zagrodnick · cz <at> gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 4 · fax +49 345 1229889 1
Zope and Plone consulting and development

Gmane