Re: [Tutor] Parsing an XML document using ElementTree

2011-06-10 Thread Sithembewena Lloyd Dube
Hi Stefan, Thanks for the code review :) Only just noticed this. On Wed, May 25, 2011 at 3:10 PM, Stefan Behnel wrote: > Sithembewena Lloyd Dube, 25.05.2011 14:40: > > Thanks for all your suggestions. I read up on gzip and urllib and also >> learned in the process that I could use urllib2 as i

Re: [Tutor] Parsing an XML document using ElementTree

2011-05-25 Thread Stefan Behnel
Sithembewena Lloyd Dube, 25.05.2011 14:40: Thanks for all your suggestions. I read up on gzip and urllib and also learned in the process that I could use urllib2 as its the latest form of that library. Herewith my solution: I don't know how elegant it is, but it works just fine. def get_contest

Re: [Tutor] Parsing an XML document using ElementTree

2011-05-25 Thread Sithembewena Lloyd Dube
Hi Everyone, Thanks for all your suggestions. I read up on gzip and urllib and also learned in the process that I could use urllib2 as its the latest form of that library. Herewith my solution: I don't know how elegant it is, but it works just fine. def get_contests(): url = ' http://xml.ma

Re: [Tutor] Parsing an XML document using ElementTree

2011-05-24 Thread Stefan Behnel
Sithembewena Lloyd Dube, 24.05.2011 11:59: 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: >>> import urllib >>> from xml.etree import ElementTree as ET >>> content = urllib.urlopen(' http://xml.matchbook.c

Re: [Tutor] Parsing an XML document using ElementTree

2011-05-24 Thread Alan Gauld
"Sithembewena Lloyd Dube" wrote And now, to iterate through its child nodes and print out the text of each node: for node in xml_content.getiterator('contest'): ...name = node.attrib.get('text') ...print name ... Nothing is printed, i = 0 for node in xml_content.geti

[Tutor] Parsing an XML document using ElementTree

2011-05-24 Thread Sithembewena Lloyd Dube
Hi Everyone, 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: >>>import urllib >>>from xml.etree import ElementTree as ET >>>content = urllib.urlopen(' http://xml.matchbook.com/xmlfeed/feed?sport-id=&vendor=T