I need to extract specific data from an xml file. The three data that I want is the node name Pause Code, Diecut and Blackout and their respective data.
The part that i want to extract data is this
<Labels>
<Label>
<Measurement Name="Pause Code" Status="Pass" Failed="false">
<Data>102000</Data>
</Measurement>
<Measurement Name="Diecut" Status="Pass" Failed="false">
<Data>Pass (7.57,12.10mm)</Data>
</Measurement>
<Measurement Name="Blackout" Status="Pass" Failed="false">
<Data>1244</Data>
</Measurement>
<errors />
<ImageFileName />
</Label>
The code that I am using is this
import xml.etree.ElementTree as ET
tree =ET.parse('006091_02_Harry_Convert.xml')
root = tree.getroot()
root.tag
for product in root:
print(product.tag, product.attrib)
for child in product:
print(child.tag, child.attrib)
when I run the program I am getting this result but i can not see the data inside the Label . Any help pls.
okCount {}
checkCount {}
LabelCount {}
ReelInfo {}
Traverse {}
YearOfManuf {}
DaysSinceXmasManuf {}
ConcealmentThresholdReached {}
ReelStatus {}
MachineID {}
ModeInfo {}
CameraID {}
Paused {}
IsMaster {}
IsSlave {}
Labels {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}
Label {}