[Tutor] how to get the content of an XML elements.
kent37 at tds.net
Wed Apr 5 14:28:53 CEST 2006
Keo Sophon wrote:
> On Sunday 02 April 2006 04:47, Kent Johnson wrote:
>> Alan Gauld wrote:
>>> "Keo Sophon" <keosophon at khmeros.info> wrote in message
>>> news:200603311906.26110.keosophon at khmeros.info...
>>>> Is there anyway to get the content of an XML elements. I am using
>>> For true XML I think ElemTree (by Fred Lundh?) is the best approach.
>>> Try a Google search.
>> Yes, it's ElementTree though.
>> Keo, what do you mean, "get the content of an XML elements"?
> for example:
> <to>someone at email.com</to>
> I would like to get "someone at email.com" of <to>.
With ElementTree it would be something like
doc = ElementTree.parse('file.xml')
to = doc.find('//to')
More information about the Tutor