But I'm saying none of the parsers don't supply the information I'd like (ie the actual parsing error that occurred) because the underlying scanner which is used by both DOM and SAX parsers throws the error away ...

See XMLScanner::scanDocument - the exception handling that is invoked (if file does not exist for example).



Dean Roddey <[EMAIL PROTECTED]>

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

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


I can't speak to the SAX2 part, since I've not looked at that variant. The parser itself does provide the information you want, but if the SAX2 specification (which the Xerces team does not define) doesn't provide a way to pass it on, then there's not much the parser can do about it.

 

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

Dean Roddey

The Charmed Quark Controller

[EMAIL PROTECTED]

www.charmedquark.com

 

-----Original Message-----
From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent:
Tuesday, September 24, 2002 4:13 PM
To:
[EMAIL PROTECTED]
Subject:
RE: How to get the error code during SAX parse?

 


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