Parsing Rdf (Rewrite)

Brandon McGinty brandon.mcginty at gmail.com
Thu May 31 01:45:01 EDT 2007


Hi All,
I'm trying to parse the rdf catalog at:
http://www.gutenberg.org/feeds/catalog.rdf.bz2
I've put it into an _ElementTree as follows:
import time
import xml.etree.cElementTree as et
tree = et.parse('c:/tmp/catalog2.rdf')
root = tree.getroot()
I would think that I could do:
etexts=tree.findall('pgterms:etext')
(or something like that), Which would pull out each etext record in the
file.
I could then do:
for book in etexts:
 print book.get('id')
This isn't yielding anything for me, no matter how I write it.
Any thoughts on this?
What am I doing wrong, or am I even in the realm of possibility, trying to
get thee elements by name?
 
Thanks,
Brandon
 
 
 
 
--
Brandon McGinty
McGinty Soft Ltd.
Website design, configuration, and maintenance
Python and PHP coder
Email:brandon.mcginty at gmail.com <mailto:Emailbrandon.mcginty at gmail.com> 
MSN:brandon_mcginty at hotmail.com
Phone:(480)-202-5790
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070530/2fd64d77/attachment.html>


More information about the Python-list mailing list