[EMAIL PROTECTED] wrote:

> Hi, recently having discovered ElementTree I'm stumped by a very simple
> problem, which I can't find the answer to.
> 
> I have some XML in a string object. Now the parse() method of
> ElementTree takes a filename or file-like object. So I tried creating a
> StringIO object from the original string and then giving that to
> parse(). But that does not seem to work.

that should work, but the fromstring function (and it's XML alias) is a 
lot easier to use.

     data = "some xml in a string"

     elem = ElementTree.XML(data)

also see the end of this section:

     http://www.effbot.org/zone/element.htm#reading-and-writing-xml-files

</F>

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to