Can we get some enlightenment on this (for the dummies!).

When you say the pluggable error call backs, do you mean the things you set by calling SAX2XMLReader::setErrorHandler or SAXParser::setErrorHandler?
If so, then these are passed a SAXParseException object which does not have an error code.
If not, which example should we look at?

From previous discussions, even if the SAXParseException object contained an error code it would only be one of

                    XMLErrs::XMLException_Fatal
                    XMLErrs::XMLException_Error
                    XMLErrs::XMLException_Warning

because XMLScanner::scanDocument basically chucks away the actual error.

So, to get the actual error code that occurred during a parse you have to hack the Xerces code base ...

Would it make sense if the scanner passed through the actual error code to XMLScanner::emitError and thence to its error reporter?  Then each of the error reporters for each parser can take the appropriate action (and one could then simply subclass the relevant parser and overload the error function to trap the actual error code).

To me there is a bit of an issue in that it is not easy to take programatic action according to the parser failure (eg take action depending if document was well formed but not valid versus malformed versus file does not exist).

What do people think?
Am I missing something?



Dean Roddey <[EMAIL PROTECTED]>

25/09/2002 08:27 AM
Please respond to xerces-c-dev

       
        To:        [EMAIL PROTECTED]
        cc:        
        Subject:        RE: How to get the error code during SAX parse?


Errors are not reported via the exceptions, they are reported via pluggable error callbacks. An exception can only report one error, because it unwinds the stack. The callbacks allow the parser to continue through more than one error (if you tell it that's ok to do.) Look at the sample programs, which clearly show how this is done.

 

-------------------------------------

Dean Roddey

The Charmed Quark Controller

[EMAIL PROTECTED]

www.charmedquark.com

 

-----Original Message-----
From:
Scot Nielsen [mailto:[EMAIL PROTECTED]]
Sent:
Tuesday, September 24, 2002 3:09 PM
To:
'Xerces-Dev (E-mail)'
Subject:
How to get the error code during SAX parse?

 

Can someone enlighten me please? There's no error code value in the SaxParseException class...

 

Are all error codes for internal use only?

 

Many thanks, Scot Nielsen

 

Reply via email to