I am sorry if this is a repeated question or a basic one as I am new to Python. I am trying to parse the following XML commands so that I can "extract" the tag value for Daniel and George. I want the answer to look like Daniel = 78, George = 90.
<epas:property name="Tom">12</epas:property>
<epas:property name="Alice">34</epas:property>
<epas:property name="John">56</epas:property>
<epas:property name="Danial">78</epas:property>
<epas:property name="George">90</epas:property>
<epas:property name="Luise">11</epas:property>
The xml commands are stored in one string. i.e. myString so here is the first part of code that I tried to parse this string (myString):
element = xml.dom.minidom.parseString(myString).getElementByTagName ("epas:property")
if not element:
print "error message"
else:
for el in element:
value [el.getAttribute("name")] = el.firstChild.data
I tried to reference Daniel and George to the array index to get the value but looks I am not doing it correctly. I would appreciate your ideas/comments on this.
Cheers, Bill