[lxml-dev] Bug in Xpath class?
![](https://secure.gravatar.com/avatar/ee1121cb0c2b9724f8dca9dce0b7dc1b.jpg?s=120&d=mm&r=g)
Hello, I am using version lxml-2.2.8-py2.6. I think I have found a bug in the Xpath class. When I use this tree: <root> <a> <i>1</i> 2 <i>3</i> </a> </root> and use this to evaluate an xpath expression: root = etree.XML("<root><a><i>1</i>2<i>3</i></a></root>") find = etree.XPath("//a") print(find(root)[0].text) it returns "None". Shouldn't this return "2" ? When I run "//a/i/text(), it returns the correct values. The "2" is nowhere to be found, not in the children of the "a" attribute or anywhere else. I really need this code to work. Is it possible to provide a solution for this? thanks in advance, Brecht
![](https://secure.gravatar.com/avatar/8b97b5aad24c30e4a1357b38cc39aeaa.jpg?s=120&d=mm&r=g)
Brecht Schoolmeesters, 15.10.2010 11:14:
<root> <a> <i>1</i> 2 <i>3</i> </a> </root> [...] The "2" is nowhere to be found, not in the children of the "a" attribute or anywhere else.
http://codespeak.net/lxml/tutorial.html#elements-contain-text Stefan
participants (2)
-
Brecht Schoolmeesters
-
Stefan Behnel