You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Fran Orzel <fm...@us.ibm.com> on 2012/12/10 21:09:21 UTC

ErrorHandler usage


I have an application that is parsing a file.  I have defined and set an
ErrorHandler for the parse.  When testing with an "invalid" file my
errorhandler runs and traces out the error as expected.  I am returning
false for Sever and Fatal errors so that parsing will not continue.
However, what is the correct method for letting the code that is doing the
parsing know that an error has occurred?  I was checking for the
DOMDocument* to be NULL, but it isn't.  The documentation says that if I
throw and exception from the errorHandler then parsing continues and that's
not what I want done....  Will checking the getSrcCount() give me a
non-zero value when an error occurs?

Fran

Re: ErrorHandler usage

Posted by Siva Chandran P <si...@gmail.com>.
I store/count the errors inside ErrorHandler. So after parsing completed I
check the ErrorHandler is there any error or not. If error occurred I stop
proceeding and convey the error to upper layer.

Thanks & Regards,
Siva Chandran P

On Tue, Dec 11, 2012 at 1:39 AM, Fran Orzel <fm...@us.ibm.com> wrote:

>
>
> I have an application that is parsing a file.  I have defined and set an
> ErrorHandler for the parse.  When testing with an "invalid" file my
> errorhandler runs and traces out the error as expected.  I am returning
> false for Sever and Fatal errors so that parsing will not continue.
> However, what is the correct method for letting the code that is doing the
> parsing know that an error has occurred?  I was checking for the
> DOMDocument* to be NULL, but it isn't.  The documentation says that if I
> throw and exception from the errorHandler then parsing continues and that's
> not what I want done....  Will checking the getSrcCount() give me a
> non-zero value when an error occurs?
>
> Fran