Just in case, under the same system, but using libxml2dom, I'm getting '<p>text2</p>' as the result: >>> doc2 = libxml2dom.parseString(html, html=True) >>> doc2.xpath("//p")[0].toString() '<p>lala</p>'