I have got this xml file :
<ItemArray>
<Item>
<GiftIcon>0</GiftIcon>
<HitCounter>NoHitCounter</HitCounter>
<Quantity>1</Quantity>
<TimeLeft>P9DT17H35M6S</TimeLeft>
<Title>Table</Title>
</Item>
<Item>
<GiftIcon>0</GiftIcon>
<HitCounter>NoHitCounter</HitCounter>
<Quantity>1</Quantity>
<TimeLeft>PT0S</TimeLeft>
<Title>Chair</Title>
</Item>
</ItemArray>
I would like to return "Title" if "TimeLeft" is not "PT0S" :
So far I have got this :
itemList = response.getElementsByTagName('Item')
children = itemList[0].childNodes
for child in children :
if child.tagName == "TimeLeft":
if child.childNodes[0].nodeValue == "PT0S":
print "ping"
But I don't know how to get back to the "Title" value from there, what would be a more elegant way to return a childnode's value depending if an other childnode is true or false ?