I have xml of the form
<root>
<tag1> </tag1>
<tag2> </tag2>
<tag3> </tag3>
<tag1> </tag1>
<tag2> </tag2>
<tag3> </tag3>
</root>
I need to parse the xml in the order
tag1 -> tag2 -> tag3 -> tag1 -> tag2 -> tag3
Currently I'm using
root = tree.getroot()
for data in root.findall('tag1')
do_operations(data)
for data in root.findall('tag2')
do_operations(data)
But this approach is giving me and that's obvious
tag1 -> tag1 -> tag2 -> tag2 -> tag3 -> tag3
which is not what I want.
Can you suggest an optimum method in which i can pasrse the XML in the desired manner. tag1 , tag2, tag3 are repeated a lot in the same order as given above.