I need some help. I have this XML:
<?xml version="1.0"?>
<WDAT>
<EMOD>
<MATERIAL number="1.2345">
<Values>
<X>20.0</X>
<Y>200.0</Y>
</Values>
<Values>
<X>100.0</X>
<Y>190.0</Y>
</Values>
<Values>
<X>200.0</X>
<Y>185.0</Y>
</Values>
<Values>
<X>300.0</X>
<Y>180.0</Y>
</Values>
<Values>
<X>400.0</X>
<Y>175.0</Y>
</Values>
</MATERIAL>
</EMOD>
</WDAT>
I want to get an array with the X-Y values for the material number 1.2345, for example.
tree_materials = ET.parse(r"materials.xml")
root_materials = tree_materials.getroot()
materials = root_materials.findall('EMOD/MATERIAL')
material = tree_materials.findall(".//MATERIAL[@number='1.2345']")
valuess = material.findall('X')
The variable "material" has the correct memory address, but I have difficulties to get the values from X and Y.
Thanks.
Rafael