Re: multiple root nodes
Karl Waclawek <[email protected]> Wed, 02 Jul 2008 08:53:08 -0400
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
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