REALLY simple xml reader

Mark Tolonen mark.e.tolonen at mailinator.com
Sun Jan 27 12:55:14 EST 2008


"Simon Pickles" <sipickles at hotmail.com> wrote in message 
news:mailman.1148.1201455326.896.python-list at python.org...
> Hi
>
> Can anyone suggest a really simple XML reader for python? I just want to 
> be able to do something like this:
>
> xmlDoc = xml.open("file.xml")
> element = xmlDoc.GetElement("foo/bar")
>
> ... to read the value of:
>
> <foo>
>   <bar>42</bar>
> </foo>
>
>
> Thanks
>
> Simon
>
> -- 
> Linux user #458601 - http://counter.li.org.
>
>
>

>>> from xml.etree import ElementTree as ET
>>> tree=ET.parse('file.xml')
>>> tree.find('bar').text
'42'
>>>

--Mark




More information about the Python-list mailing list