My XML looks something like: (Sorry if duplicate question, but I'm not very experienced with XML so I have a bit trouble with the terminology
<sometags>
<Value>
<Scalar unitGlobalDataRef="Unit_0" unit="None" xmlns="xxxxyyyy">20</Scalar>
</Value>
</sometags>
Using this code:
element = ET.parse(fileName)
root = element.getroot()
for subelement in root:
if (subelement.tag == "{xxyy}Parameter"):
for value in subelement:
for subval in value:
#Here is where it prints
if (subval.tag == "{xxxxyyyy}Scalar"):
print subval.tag
print subval.text
print subval.tail
print subval.attrib
prints
{xxxxyyyy}Scalar
0
{'unitGlobalDataRef': 'Unit_0', 'unit': 'None'}
How can I get the value 20 out from the element?
subvalvariable?root.findall('.//{xxxxyyyy}Scalar')for a recursive search.