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

8.5. Element.find(): Find a matching sub-element

You can search for sub-elements of an Element instance E using this method call:

E.find ( path )

The possible values of the path argument use the same syntax as the path argument in Section 7.1, “ElementTree.find(). However, the search starts at element E, rather than at the top of the document.

If there are any matching elements, this method returns the matching element that is first in document order. If there are no matching elements, the method returns None.

For example, if node is an Element instance that has an element child with a tag "county", and that child in turn has an element child with tag "ppl", this expression will return the Element corresponding to the "ppl" child:

node.find ( "county/ppl" )