Using XML w/ Python...
uche.ogbuji at gmail.com
uche.ogbuji at gmail.com
Sun Dec 11 19:35:22 EST 2005
"""
Ok, i am now understanding some of parseing and how to use it and
nodes, things like that. But say i wanted to take the title of
http://www.digg.com/rss/index.xml
and XMLTramp seemed the most simple to understand.
would the path be something like this?
import xmltramp
rssDigg = xmltramp.load("http://www.digg.com/rss/index.xml")
print note.rss.channel.item.title
I think thats wat im having the most confusion on now, is how to direct
to the path that i want...
"""
I suggest you read at least the front page information for the tools
you are using. It's quite clear from the xmltramp Web site (
http://www.aaronsw.com/2002/xmltramp/ ) that you want tomething like
(untested: the least homework you can do is to refine the example
yourself):
print rssDigg[rss.channel][item][title]
BTW, in Amara, the API is pretty much exactly what you guessed:
>>> import amara
>>> rssDigg = amara.parse("http://www.digg.com/rss/index.xml")
>>> print rssDigg.rss.channel.item.title
Video: Conan O'Brien iPod Ad Parody
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/
More information about the Python-list
mailing list