I have an xml file of the following form:
<Op Id="Op_Join" I="14">
<Op Id="Op_Sort" I="1">
<Op Id="Op_Join" I="2">
<Op Id="Op_Exchange" I="11">
<Op Id="Op_Extract" I="5">
</Op>
</Op>
</Op>
</Op>
</Op>
Now I want to traverse this xml file in a bottom-up manner. That is, starting from the bottom "Op_Extract". I want to find the first "Op_Join" that it comes across while traversing from bottom to top. In the example xml file above the first "Op_Join" has I="2".
I know I can use "xml.etree.ElementTree" in python to traverse the xml file in a top-down manner. However I am looking for a way to traverse the xml file in a bottom-up manner.
The xml document that I have can be arbitrarily complex. The snippet pasted here is just for exposition.