[XML-SIG] using PyXML on a string

Thomas B. Passin tpassin@comcast.net
Fri, 23 May 2003 01:19:29 -0400


[Paul Tremblay]

> I would like to use SAX to parse a string rather than a file. Is there
> a way? I know how to use expat directly to parse a string, and I know
> how to use SAX to parse a file. However, one cannot use expat in the
> way I like:
>

One easy way is to use StringIO (or cStringIO) to turn the string into a
file-like object.  Then feed it to the parser as if it were a file.

Cheers,

Tom P