Hi Everyone,<br><br>I am trying to parse an XML feed and display the text of each child node without any success. My code in the python shell is as follows:<br><br><span style="color: rgb(51, 51, 255);">&gt;&gt;&gt;import urllib</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">&gt;&gt;&gt;</span><span style="color: rgb(51, 51, 255);">from xml.etree import ElementTree as ET</span><br style="color: rgb(51, 51, 255);"><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">&gt;&gt;&gt;</span><span style="color: rgb(51, 51, 255);">content = urllib.urlopen(&#39;<a href="http://xml.matchbook.com/xmlfeed/feed?sport-id=&amp;vendor=TEST&amp;sport-name=&amp;short-name=Po">http://xml.matchbook.com/xmlfeed/feed?sport-id=&amp;vendor=TEST&amp;sport-name=&amp;short-name=Po</a>&#39;)</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">&gt;&gt;&gt;</span><span style="color: rgb(51, 51, 255);">xml_content = ET.parse(content)</span><br clear="all"><br>I then check the xml_content object as follows:<br><br><span style="color: rgb(51, 51, 255);">&gt;&gt;&gt;xml_content</span><br>
<span style="color: rgb(255, 102, 0);">&lt;xml.etree.ElementTree.ElementTree instance at 0x01DC14B8&gt;</span><br><br>And now, to iterate through its child nodes and print out the text of each node:<br><br><span style="color: rgb(51, 51, 255);">&gt;&gt;&gt;for node in xml_content.getiterator(&#39;contest&#39;):</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">...        name = node.attrib.get(&#39;text&#39;)</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">...        print name</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">...</span><br><span style="color: rgb(51, 51, 255);">&gt;&gt;&gt;</span><br><br>Nothing is printed, even though the document does have &#39;contest&#39; tags with text in them. If I try to count the contest tags and increment an integer (to see that the document is traversed) I get the same result - the int remains at 0.<br>
<br><span style="color: rgb(51, 51, 255);">&gt;&gt;&gt; i = 0</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">&gt;&gt;&gt; for node in xml_content.getiterator(&#39;contest&#39;):</span><br style="color: rgb(51, 51, 255);">
<span style="color: rgb(51, 51, 255);">...     i += 1</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">...</span><br style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);">&gt;&gt;&gt; i</span><br>
<span style="color: rgb(255, 102, 0);">0</span><br><br>What am I getting wrong? Any hints would be appreciated.<br><br>-- <br>Regards,<br>Sithembewena Lloyd Dube<br>