Recently, I have been playing with ElementTree, let's see ..
>>> from xml.etree import ElementTree >>> help(ElementTree.ElementPath) >>> root = ElementTree.fromstring(""" <root><child>One</child><child>Two</child><child>Three</child></root> """) >>> ElementTree.ElementPath.findall(root, "child") [<Element child at 2ac98c0>, <Element child at 2ac9638>, <Element child at 2ac9518>] >>> elements = ElementTree.ElementPath.findall(root, "child") >>> two = [x for x in elements if x.text == "Two"] >>> two[0].text 'Two'
Is this what you are looking for right? He says that ElementPath has limited xpath support, but he doesn't talk about support at all.
source share