You are here

python, xpath and ElementTree

on May 16, 2010

Failed to find a xpath solution in python2.6 standard library. Seems like ElementTree is the only API have limited xpath support. But...
 
http://effbot.org/zone/element-xpath.htm
http://codespeak.net/pipermail/lxml-dev/2006-May/001294.html
And for my test code:

deps = tree.findall("//dependency[@testP='testV']")
print deps

 
Error:

SyntaxError: expected path separator ([)
 
Also Find:

>>> from xml.etree import ElementTree
>>> print ElementTree.VERSION
1.2.6

So I have to wait until ElementTree is upgraded to version 1.3