title: Parsing xml childnodes in python
body: <p>I have got this xml file :</p>
  
  <pre><code> &lt;ItemArray&gt;
      &lt;Item&gt;
        &lt;GiftIcon&gt;0&lt;/GiftIcon&gt;
        &lt;HitCounter&gt;NoHitCounter&lt;/HitCounter&gt;
        &lt;Quantity&gt;1&lt;/Quantity&gt;
        &lt;TimeLeft&gt;P9DT17H35M6S&lt;/TimeLeft&gt;
        &lt;Title&gt;Table&lt;/Title&gt;
      &lt;/Item&gt;
      &lt;Item&gt;
        &lt;GiftIcon&gt;0&lt;/GiftIcon&gt;
        &lt;HitCounter&gt;NoHitCounter&lt;/HitCounter&gt;
        &lt;Quantity&gt;1&lt;/Quantity&gt;
        &lt;TimeLeft&gt;PT0S&lt;/TimeLeft&gt;
        &lt;Title&gt;Chair&lt;/Title&gt;
      &lt;/Item&gt;
    &lt;/ItemArray&gt;
  </code></pre>
  
  <p>I would like to return "Title" if "TimeLeft" is not "PT0S" :</p>
  
  <p>So far I have got this :</p>
  
  <pre><code>itemList = response.getElementsByTagName('Item')
  children = itemList[0].childNodes
  for child in children :
    if child.tagName == "TimeLeft":
      if child.childNodes[0].nodeValue == "PT0S": 
         print "ping"
  </code></pre>
  
  <p>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 ?</p>