[lxml-dev] Problem with xpath behaviour.

Bruno Deferrari utizoc at gmail.com
Mon Aug 13 21:32:12 CEST 2007


Hi, I'm using lxml 1.3.3, libxml2 2.6.29 and python 2.5.1, and I'm
getting a weird behaviour when using xpath, for example:

>>> from lxml import etree
>>> html = '<html><body>text1<p>text2</p>text3<b>text4</b>text5</body></html>'
>>> doc = etree.HTML(html)
>>> etree.tostring(doc.xpath('//p')[0])
'<p>text2</p>text3'

Shouldn't I be getting just '<p>text2</p>' ?


More information about the lxml-dev mailing list