internet data handling and encoding an instance tree of elementtree has the following methodstree _setroot(elementsets the root element to element tree find(pathfinds and returns the first top-level element in the tree whose type matches the given path path is string that describes the element type and its location relative to other elements the following list describes the path syntaxpath description matches only top-level elements with the given tag--for exampledoes not match elements defined at lower levels element of type tag embedded inside another element such as is not matched 'parent/tagmatches an element with tag 'tagif it' child of an element with tag 'parentas many path name components can be specified as desired '*selects all child elements for example'*/tagwould match all grandchild elements with tag name of 'tagstarts the search with the current node '//selects all subelements on all levels beneath an element for example//tagmatches all elements with tag 'tagat all sublevels 'tagif you are working with document involving xml namespacesthe tag strings in path should have the form '{uri}tagwhere uri is string such as 'tree findall(pathfinds all top-level elements in the tree that match the given path and returns them in document order as list or an iterator tree findtext(path [default]returns the element text for the first top-level element in the tree matching the given path default is string to return if no matching element can be found tree getiterator([tag]creates an iterator that produces all elements in the treein section orderwhose tag matches tag if tag is omittedthen every element in the tree is returned in order tree getroot(returns the root element for the tree tree parse(source [parser]parses external xml data and replaces the root element with the result source is either filename or file-like object representing xml data parser is an optional instance of treebuilderwhich is described later lib fl ff