Close! In xpath the following is valid (tested in lxml
to make sure!)
root.xpath('//planet[name[text()="Kepler"]]')
which is equivalently written:
root.xpath('//planet[name="Kepler"]')
Now, xml.etree
doesn't seem to like the former XPath
expression (Invalid Predicate
?!) but it's cool with the latter. Oh well. So then we have:
root.findall('.//planet[name="Kepler"]')