xml parsing with sax
Harald Kirsch
kirschh at lionbioscience.com
Fri Apr 27 13:11:42 EDT 2001
"Alex Martelli" <aleaxit at yahoo.com> writes:
> "Harald Kirsch" <kirschh at lionbioscience.com> wrote in message
> news:yv28zkm63gi.fsf at lionsp093.lion-ag.de...
> [snip]
> > it possible to push a pseudo root element in front of a stream parsed
> > with
> >
> > xml.sax.parse(sys.stdin, ...)
>
>
> If the stream fits in memory, it's clearly easy:
No, it does not fit.
[snip]
> def wrapWith(tag, fileob):
> return FileWrappedWithTag(tag, fileob)
>
> xml.sax.parse(wrapWith("fakedoc",sys.stdin), Handler())
>
>
> Fortunately, the parser just calls .read(N) on its
*That* was the information I was missing. The rest is then more or
less straighforward, as your example code demonstrates.
Thanks,
Harald Kirsch
--
----------------+------------------------------------------------------
Harald Kirsch | kirschh at lionbioscience.com | "How old is the epsilon?"
LION bioscience | +49 6221 4038 172 | -- Paul Erdös
*** Please do not send me copies of your posts. ***
More information about the Python-list
mailing list