Next / Previous / Contents / TCC Help System / NM Tech homepage

8. class ElementTree: A complete XML document

Once you have used the etree.ElementTree constructor to instantiate an XML document, you can use these methods on that instance.

8.1. ElementTree.find()

ET.find(path[, namespaces=D])

This method is used to find a specific single element in the document. It is essentially equivalent to calling the .find() method on the document's root element; see Section 9.5, “Element.find(): Find a matching sub-element”.

For example, if doc is an ElementTree instance, this call:

    doc.find('h1')

is equivalent to:

    doc.getroot().find('h1')