[lxml-dev] removing nested element from html wipes text
iShTa dAsaH
ishtadasah at gmail.com
Mon Jan 28 21:03:10 CET 2008
Hi
I got missing text after removing last element..
I've tried 2.0 beta but still no luck.
txt="""
'<p>
startPara
<strong>str0ng</strong>
MiddleP
<u>UUUUUUUUU</u>
<b>Bold</b>
EndPara
</p>"""
ee=etree.HTML(txt)
pp=ee.xpath('//p')[0]
>>> pp.tail
>>> pp.xpath('./text()')
['startPara', 'MiddleP', 'EndPara']
>>> bold=pp.xpath('./b')[0]
>>> bold.clear()
>>> pp.xpath('./text()')
['startPara', 'MiddleP']
as at seen EndPara text is missing
More information about the lxml-dev
mailing list