Hi,
xhtmltree = lxml.html.parse(StringIO(xhtmlsrc)) xhtmltree.test_content() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'lxml.etree._ElementTree' object has no attribute 'test_content'
xhtmltree = lxml.html.document_fromstring(xhtmlsrc) xhtmltree.text_content() 'Testing'
/Again why there is this deferent result when it documentation it is not reported?/
You are missing the distinction between Elements and ElementTrees: http://codespeak.net/lxml/tutorial.html#parsing-from-strings-and-files
xhtmlsrc = '<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><div><br />Testing</div>'
xhtmltree = lxml.html.parse(StringIO(xhtmlsrc)) type(xhtmltree) <type 'lxml.etree._ElementTree'>
xhtmltree = lxml.html.document_fromstring(xhtmlsrc) type(xhtmltree) <class 'lxml.html.HtmlElement'>
ElementTree and Element have a different API. I can't really comment on your other questions as I've never used lxml.html. Holger -- GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99 €/mtl.!* http://portal.gmx.net/de/go/dsl