ElementTree : parse string input

rajarshi.guha at gmail.com rajarshi.guha at gmail.com
Thu Jul 6 10:38:10 EDT 2006


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.

Any pointers to getting ElementTree to parse from a string would be
appreciated (of course I could dump it to a temp file, but that doesn't
seem elegent)

Thanks,
Rajarshi




More information about the Python-list mailing list