I'm using ElementTree with Python to parse an XML file.
This is the sample of XML file I'm trying to parse:
<?xml version="1.0" encoding="UTF-8"?>
<objects fpmi.archive.type="components" framework.version="7.9.8.2018060714" fpmi.version="9.9.8.0" timestamp="Thu Sep 27 15:00:19 CEST 2018">
<arraylist len="0"/>
<c cls="com.inductiveautomation.factorypmi.application.components.template.TemplateHolder">
<c-comm>
<p2df>26.0;14.0</p2df>
<r2dd>10.0;10.0;26.0;14.0</r2dd>
<str>X123_C61023</str>
<lc>10.0;10.0;16;0;0.7058824;1.3333334</lc>
</c-comm>
<c-c m="setParameterValues" s="1;java.util.Map">
<o cls="java.util.HashMap">
<o-c m="put" s="2;O;O">
<str>tagPath</str>
<str>X123_X123_C61023</str>
</o-c>
</o>
</c-c>
<c-c m="setTemplatePath" s="1;str">
<str>[network]premium/aw1/tags/monitors</str>
</c-c>
</c>
console always return None .
My code:
import xml.etree.ElementTree as ET
mytree = ET.parse('sample.xml')
myroot = mytree.getroot()
for x in myroot.findall('c'):
p2df=x.find('p2df')
r2dd=x.find('r2dd')
print(p2df, r2dd)
Please help..