in reply to Incremental parsing of multiple XML streams?

Can't you just pipe the data to the parser as it comes, so the parser thinks it is just a regular file? Have a process that gets the data, then pipes it to the process that parses it.

Replies are listed 'Best First'.
Re^2: Incremental parsing of XML?
by nothingmuch (Priest) on Jan 07, 2005 at 22:01 UTC
    Given
    parser a parser b stream a stream b
    I would like to give parser a data from stream a, and parser b data from stream b, simultaneously, in the same process (no threads).

    You can just use a select loop, and read nonblocking on your own, to get data from multiple streams at the same time.

    What I need to get this done is parsers that can be told 'here is more data', and have them return even if that's not a complete XML document. They parse as much as they can given the current buffer which they keep. When more data will become available, they continue parsing.

    Basically, instead of reading more from a handle, i'd like the parsers to return control to me, so I can give them more strings.

    -nuffin
    zz zZ Z Z #!perl