Here is my XML structure:
<images>
<image>
<name>brain tumer</name>
<location>images/brain_tumer1.jpg</location>
<annotations>
<comment>
<name>Patient 0 Brain Tumer</name>
<description>
This is a tumer in the brain
</description>
</comment>
</annotations>
</image>
<image>
<name>brain tumer</name>
<location>img/brain_tumer2.jpg</location>
<annotations>
<comment>
<name>Patient 1 Brain Tumer</name>
<description>
This is a larger tumer in the brain
</description>
</comment>
</annotations>
</image>
</images>
I am new to Python and wanted to know if retrieving the location data based on the comment:name data was posible? In other words here is my code:
for itr1 in itemlist :
commentItemList = itr1.getElementsByTagName('name')
for itr2 in commentItemList:
if(itr2.firstChild.nodeValue == "Patient 1 Liver Tumer"):
commentName = itr2.firstChild.nodeValue
Loacation = it1.secondChild.nodeValue
Any recommendations or am i missing somthing here? Thank you in advance.