Use the iterparse() function of the xml.etree.ElementTree package.

http://effbot.org/zone/element-iterparse.htm
http://codespeak.net/lxml/parsing.html#iterparse-and-iterwalk

Stefan

iterparse() is too big a hammer for this purpose, IMO. How about this:

 from xml.etree.ElementTree import ElementTree
 tree = ElementTree(None, "myfile.xml")
 for elem in tree.findall('//book/title'):
     print elem.text


-John

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to