I use python and ElementTree for parsing my xml files. Lets assume I have the following content:
<basic name="myAssignments" type="INTEL">
<sirius dataType="UINT">
<assignmnt>
<side_a value="a0" desc="sirius_desc_a0"/>
<side_b value="b0" desc="sirius_desc_b0"/>
</assignmnt>
<assignmnt>
<side_a value="a1" desc="sirius_desc_a1"/>
<side_b value="b1" desc="sirius_desc_b1"/>
</assignmnt>
<assignmnt>
<side_a value="a2" desc="sirius_desc_a2"/>
<side_b value="b2" desc="sirius_desc_b2"/>
</assignmnt>
</sirius>
</basic>
I am not getting it to return a list of all the assignments as a list with tuples in this format:
[(a0,"sirius_desc_a0",b0,"sirius_desc_b0")
(a1,"sirius_desc_a1",b1,"sirius_desc_b1")
(a2,"sirius_desc_a2",b2,"sirius_desc_b2")]
In this case the list will have a len of 3 and each object is a tuple with the mapping just in simple order.
Can someone give a help?
I got to know how I can fetch a single attribut of an element, but here I need multiple attributes.
Here's a way:
Output:
If there are other nodes under
assignmnt, you may want the more explicit: