Keo Sophon wrote: > On Sunday 02 April 2006 04:47, Kent Johnson wrote: >> Alan Gauld wrote: >>> "Keo Sophon" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>> >>>> Is there anyway to get the content of an XML elements. I am using >>>> xml.dom. >>> 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"? >> >> Kent > > for example: > > ..... > <to>[EMAIL PROTECTED]</to> > ..... > > I would like to get "[EMAIL PROTECTED]" of <to>.
With ElementTree it would be something like doc = ElementTree.parse('file.xml') to = doc.find('//to') print to.text Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor