On Mon, 4 Jun 2001 14:54:06 -0400, Amato, Matt wrote:

>       In this case, I have another question, please keep in mind I'm new
>to XML so if it's a stupid question, I apologize.  Should the parser ignore
>everything after the root element?  What I mean is if I have a valid XML
>file and I have junk after the root element is finished, should it throw a
>"Comment expected error" as it does now, or should it just ignore the junk?
>I currently have this problem and I'm trying to find the most efficient way
>to make the parser stop at the end of the root element even if my buffer
>contains erroneous data afterwards.

One way would be to install a pass-through SAX handler into your parser, that
sets an eof flag in your input source when it sees the end of document event.
The only problem I see with that is when the parser already read a chunk of
data BEYOND the closing root tag.

So maybe make the parser stop altogether at that point, by throwing your own
exception:

void mySaxHandler::endDocument() {
        delegate->endDocument();
        throw mySaxEof;
}


Ciao, J�rgen

--
J�rgen Hermann, Developer ([EMAIL PROTECTED])
WEB.DE AG, http://webde-ag.de/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to