XML help
Joonas Paalasmaa
joonas at olen.to
Tue Mar 19 10:23:28 EST 2002
Vincent Foley <vince at news.videotron.ca> wrote in message news:<AYpl8.16002$i66.686070 at wagner.videotron.net>...
> Hi,
>
> I have a XML document <http://freshmeat.net/projects-xml/vim/vim.xml>.
> I want to put the latest_version value in a variable. How would I do
> that?
By using xml.dom.minidom.
from xml.dom import minidom
import urllib
doc = minidom.parse(urllib.urlopen("http://freshmeat.net/projects-xml/vim/vim.xml"))
print doc.getElementsByTagName("project-listing")[0]. \
getElementsByTagName("project")[0]. \
getElementsByTagName("latest_version")[0].childNodes[0].data
More information about the Python-list
mailing list