[Expat-discuss] multiple root nodes

Karl Waclawek karl at waclawek.net
Wed Jul 2 14:53:08 CEST 2008


Daniel Önnerby wrote:
> Hi all!
>
> I'm just wondering if there is a way to have multiple root nodes. I 
> seem to be getting a "junk after doc" kind of error (do not remember 
> the exact error message) when I start on a second root node.
> In normal cases this is what to expect, but in my case I'm using expat 
> to parse continuously from a socket stream, so multiple root nodes are 
> allowed.
>
Expat must be told when the document ends, as after the last end-element 
tag there can still be comments, processing instructions or whitespace. 
So you must detect the beginning of a new document outside of Expat and 
then re-start the parsing process.

Karl


More information about the Expat-discuss mailing list