XML parsing: set great-great-...-grandchild element as a root in Python



I have a XML file which has structure like this:



<element1>
<element2>
...
<element10 name="a">
...


I am trying to parse this file in Python 2.7, using The ElementTree XML API. But the data I am looking for are deeply hidden in the structure.


Is there any way I can set specific great-great-...-grand child element (for example the element10) as the root element without iterating the whole structure?


No comments:

Post a Comment