31 Jan 05:06
ElementTree 1.3a xpath position broken?
Richard Baron Penman <richardbp+lxml <at> gmail.com>
2010-01-31 04:06:56 GMT
2010-01-31 04:06:56 GMT
hello,
I am after xpath support for an application running on Google App Engine, which unfortunately rules out lxml.
According to this document (http://effbot.org/zone/element-xpath.htm) the development version of ElementTree 1.3a has additional support for xpath, which covers my use cases.
From my tests I found attributes and child nodes work:
>>> from elementtree import ElementTree
>>> tree = ElementTree.fromstring('<a><b></b><b><c class="test"></c></b></a>')
>>> print list(tree.findall('.//*[ <at> class="test"]'))
[<Element 'c' at b7caa0cc>]
>>> print list(tree.findall('.//b[c]'))
[<Element 'b' at b7caa08c>]
However tag positions appear to be broken:
>>> print list(tree.findall('.//b[1]')) # should return b element
[]
Have I missed something? Suggestions?
regards,
Richard
_______________________________________________ lxml-dev mailing list lxml-dev <at> codespeak.net http://codespeak.net/mailman/listinfo/lxml-dev
RSS Feed