I have the following XML file:
<annotations count="1">
<track id="0" label="Machine">
<box frame="0" ><attribute id="8">act1</attribute></box>
<box frame="1" ><attribute id="8">act2</attribute></box>
<box frame="2" ><attribute id="8">act1</attribute></box>
</track>
</annotations>
I want to extract the frame and the action inside attribute. For example i would like to have (frame: 0 , act1), (frame: 1 , act2) ... Right now what I am doing is
root = xml.etree.ElementTree.parse(xml_file_path).getroot()
for track in root.iter('track'):
for box in track.iter('box'):
frame = box.get('frame')
How can I obtain also the corresponding attribute ( act1, ..., act 1) ?