The term descendants refers to an element's children, their children, and so on all the way to the leaves of the document tree.
For an Element instance , this method
returns an iterator that visits all of E's descendants in
document order.
E
E.iterdescendants(tag=None)
If you want the iterator to visit only elements with a
specific tag name , pass an argument Ntag=.
N
Example:
>>> xml = '''<root>
... <grandpa>
... <dad>
... <yuo/>
... </dad>
... </grandpa>
... </root>'''
>>> root = etree.fromstring(xml)
>>> you = root.xpath('.//yuo')[0]
>>> for anc in you.iterancestors():
... print anc.tag,
dad grandpa root
>>>