Skip to content Skip to sidebar Skip to footer

Return Xpath Attribute Value With Elementtree

I want to evaluate XML documents with this kind of structure: ... where Service_name tag name is

Solution 1:

ElementTree uses its own path syntax, which is more or less a subset of xpath. If you want an ElementTree compatible library with full xpath support, try lxml.

Solution 2:

Although it's not XPath as question name, this seems like one way:

doc.getroot().get('version')

Post a Comment for "Return Xpath Attribute Value With Elementtree"