You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Chris Hill <ch...@wolfram.com> on 2000/08/17 18:33:23 UTC

Validity errors fatal?

I am attempting to write an application that will record validity errors, 
but will continue to processing and return a result for well formed 
input.  Validity errors are sent to my ErrorHandler via the error function 
rather than the fatalError function, but they are still fatal.

Here is the code from XMLValidator.cpp that decides if an error is fatal:
     // Bail out if its fatal an we are to give up on the first fatal error
     if ((XMLValid::isValid(toEmit) || XMLValid::isFatal(toEmit))
     &&  fScanner->getExitOnFirstFatal()
     &&  !fScanner->getInException())
     {
         throw toEmit;
     }

Is there a reason that validity errors are grouped with fatal errors?

Chris


Re: Validity errors fatal?

Posted by Craig Noah <Cr...@ca.com>.
Chris,

The reason no one has complained about validity errors being fatal is that (for
some of us at least), validity errors are considered fatal.  It depends on the
application being written.

Craig

Chris Hill wrote:

> At 09:21 PM 8/21/2000, you wrote:
> > > My code will not ignore the validity errors, but I think there should be a
> > > way to make the parser do so without ignoring all errors.
> > >
> >
> >Its not ignoring the errors if you turn off first error. It just won't stop
> >on the first WF error, it'll try to keep going if it can.
>
> It seems like the best supported soultion for my problem is to
> 1) set the ignore first fatal flag in the parser
> 2) when receiving the first fatalerror, set a private flag that tells the
> error handler and document handler to ignore all future events
>
> This will give the illusion of the behavior I want.
>
> > > Again, validation errors call ErrorHandler::error, not
> > > ErrorHandler::fatalError, so why are they fatal?
> > >
> >
> >That's just a SAX parser thing, it has nothing to do with the core system.
> >If someone chose to have validity errors go out SAX parser's error() instead
> >of fatalerror(), that just means that this is how SAX choose to do them. It
> >doesn't mean that the rest of the system necessarily has to conform to that
> >view of things. I don't even know for sure if the SAX parser should be
> >acting the way it does, to be honest.
>
> I just downloaded and tested Xerces J, and it behaves as I would
> expect.  Since nobody has indicated that this is any kind of problem, I
> will just need to work with the current implementation I guess. :-(
>
> >--------------------------
> >Dean Roddey
> >The CIDLib C++ Frameworks
> >Charmed Quark Software
> >droddey@charmedquark.com
> >http://www.charmedquark.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

--
Craig Noah                          INTERNET: Craig.Noah@ca.com
Programmer                                  Computer Associates
1404 Fort Crook Road South         Phone:  (402) 291-8300 x 284
Bellevue,  NE   68005-2969         FAX:    (402) 291-4362




Re: Validity errors fatal?

Posted by Chris Hill <ch...@wolfram.com>.
At 09:21 PM 8/21/2000, you wrote:
> > My code will not ignore the validity errors, but I think there should be a
> > way to make the parser do so without ignoring all errors.
> >
>
>Its not ignoring the errors if you turn off first error. It just won't stop
>on the first WF error, it'll try to keep going if it can.

It seems like the best supported soultion for my problem is to
1) set the ignore first fatal flag in the parser
2) when receiving the first fatalerror, set a private flag that tells the 
error handler and document handler to ignore all future events

This will give the illusion of the behavior I want.

> > Again, validation errors call ErrorHandler::error, not
> > ErrorHandler::fatalError, so why are they fatal?
> >
>
>That's just a SAX parser thing, it has nothing to do with the core system.
>If someone chose to have validity errors go out SAX parser's error() instead
>of fatalerror(), that just means that this is how SAX choose to do them. It
>doesn't mean that the rest of the system necessarily has to conform to that
>view of things. I don't even know for sure if the SAX parser should be
>acting the way it does, to be honest.

I just downloaded and tested Xerces J, and it behaves as I would 
expect.  Since nobody has indicated that this is any kind of problem, I 
will just need to work with the current implementation I guess. :-(

>--------------------------
>Dean Roddey
>The CIDLib C++ Frameworks
>Charmed Quark Software
>droddey@charmedquark.com
>http://www.charmedquark.com


Re: Validity errors fatal?

Posted by Dean Roddey <dr...@charmedquark.com>.
> I want the parser to continue.  I want to display validation errors as
> warnings to the user while still returning a result (which is possible as
> long as the input is well-formed).  I need to know about validity errors
> without the parser choking on them.
>

You really do get that if you turn off the first error stuff though. The
validity errors are errors, but they won't ever stop the parser. Which gets
us back to the start again.

> My code will not ignore the validity errors, but I think there should be a
> way to make the parser do so without ignoring all errors.
>

Its not ignoring the errors if you turn off first error. It just won't stop
on the first WF error, it'll try to keep going if it can.

> Again, validation errors call ErrorHandler::error, not
> ErrorHandler::fatalError, so why are they fatal?
>

That's just a SAX parser thing, it has nothing to do with the core system.
If someone chose to have validity errors go out SAX parser's error() instead
of fatalerror(), that just means that this is how SAX choose to do them. It
doesn't mean that the rest of the system necessarily has to conform to that
view of things. I don't even know for sure if the SAX parser should be
acting the way it does, to be honest.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"



Re: Validity errors fatal?

Posted by Chris Hill <ch...@wolfram.com>.
At 09:10 PM 8/18/2000, you wrote:
>I thought you just wanted it to continue and not stop just because of an
>error. If you want to ignore validity errors, just don't validate.

I want the parser to continue.  I want to display validation errors as 
warnings to the user while still returning a result (which is possible as 
long as the input is well-formed).  I need to know about validity errors 
without the parser choking on them.

My code will not ignore the validity errors, but I think there should be a 
way to make the parser do so without ignoring all errors.

Again, validation errors call ErrorHandler::error, not 
ErrorHandler::fatalError, so why are they fatal?

>--------------------------
>Dean Roddey
>The CIDLib C++ Frameworks
>Charmed Quark Software
>droddey@charmedquark.com
>http://www.charmedquark.com
>
>"You young, and you gotcha health. Whatchoo wanna job fer?"
>
>
>----- Original Message -----
>From: "Chris Hill" <ch...@wolfram.com>
>To: <xe...@xml.apache.org>
>Sent: Friday, August 18, 2000 7:15 AM
>Subject: Re: Validity errors fatal?
>
>
> > At 09:47 PM 8/17/2000, you wrote:
> > >Turn off 'exit on first fatal' before you parse. Then it will go as far a
> > >sit can. Since validatity errors would probably never keep it from
> > >continuing, its basically going to report but ignore validity errors.
> > >
> > >--------------------------
> > >Dean Roddey
> > >The CIDLib C++ Frameworks
> > >Charmed Quark Software
> > >droddey@charmedquark.com
> > >http://www.charmedquark.com
> >
> > Yes, but won't this also ignore fatal errors such as well-formedness?  I
> > suppose I could parse twice, once with validiy checking turned off,  and
> > again with it turned on and fatal errors ignored.  This seems like a
> > waste.  Perhaps I could throw an exception from my fatal error handler to
> > distinguish real fatal errors from fake ones?
> >
> > I want to make sure that this is the intended behavior of the parser,
>since
> > it would seem very convienent to have two distinct classes of errors, one
> > for well-formedness and another for validity.  In fact the code which
>calls
> > the ErrorHandler interface to report does make a severity judgement call
> > (error vs fatalError), but the behavior of the parser does not seem
> > consistent with this philosophy.
> >
> > Chris
> >


Re: Validity errors fatal?

Posted by Dean Roddey <dr...@charmedquark.com>.
I thought you just wanted it to continue and not stop just because of an
error. If you want to ignore validity errors, just don't validate.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message -----
From: "Chris Hill" <ch...@wolfram.com>
To: <xe...@xml.apache.org>
Sent: Friday, August 18, 2000 7:15 AM
Subject: Re: Validity errors fatal?


> At 09:47 PM 8/17/2000, you wrote:
> >Turn off 'exit on first fatal' before you parse. Then it will go as far a
> >sit can. Since validatity errors would probably never keep it from
> >continuing, its basically going to report but ignore validity errors.
> >
> >--------------------------
> >Dean Roddey
> >The CIDLib C++ Frameworks
> >Charmed Quark Software
> >droddey@charmedquark.com
> >http://www.charmedquark.com
>
> Yes, but won't this also ignore fatal errors such as well-formedness?  I
> suppose I could parse twice, once with validiy checking turned off,  and
> again with it turned on and fatal errors ignored.  This seems like a
> waste.  Perhaps I could throw an exception from my fatal error handler to
> distinguish real fatal errors from fake ones?
>
> I want to make sure that this is the intended behavior of the parser,
since
> it would seem very convienent to have two distinct classes of errors, one
> for well-formedness and another for validity.  In fact the code which
calls
> the ErrorHandler interface to report does make a severity judgement call
> (error vs fatalError), but the behavior of the parser does not seem
> consistent with this philosophy.
>
> Chris
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


Re: Validity errors fatal?

Posted by Chris Hill <ch...@wolfram.com>.
At 09:47 PM 8/17/2000, you wrote:
>Turn off 'exit on first fatal' before you parse. Then it will go as far a
>sit can. Since validatity errors would probably never keep it from
>continuing, its basically going to report but ignore validity errors.
>
>--------------------------
>Dean Roddey
>The CIDLib C++ Frameworks
>Charmed Quark Software
>droddey@charmedquark.com
>http://www.charmedquark.com

Yes, but won't this also ignore fatal errors such as well-formedness?  I 
suppose I could parse twice, once with validiy checking turned off,  and 
again with it turned on and fatal errors ignored.  This seems like a 
waste.  Perhaps I could throw an exception from my fatal error handler to 
distinguish real fatal errors from fake ones?

I want to make sure that this is the intended behavior of the parser, since 
it would seem very convienent to have two distinct classes of errors, one 
for well-formedness and another for validity.  In fact the code which calls 
the ErrorHandler interface to report does make a severity judgement call 
(error vs fatalError), but the behavior of the parser does not seem 
consistent with this philosophy.

Chris




Re: Validity errors fatal?

Posted by Dean Roddey <dr...@charmedquark.com>.
Turn off 'exit on first fatal' before you parse. Then it will go as far a
sit can. Since validatity errors would probably never keep it from
continuing, its basically going to report but ignore validity errors.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"


----- Original Message -----
From: "Chris Hill" <ch...@wolfram.com>
To: <xe...@xml.apache.org>
Sent: Thursday, August 17, 2000 9:33 AM
Subject: Validity errors fatal?


> I am attempting to write an application that will record validity errors,
> but will continue to processing and return a result for well formed
> input.  Validity errors are sent to my ErrorHandler via the error function
> rather than the fatalError function, but they are still fatal.
>
> Here is the code from XMLValidator.cpp that decides if an error is fatal:
>      // Bail out if its fatal an we are to give up on the first fatal
error
>      if ((XMLValid::isValid(toEmit) || XMLValid::isFatal(toEmit))
>      &&  fScanner->getExitOnFirstFatal()
>      &&  !fScanner->getInException())
>      {
>          throw toEmit;
>      }
>
> Is there a reason that validity errors are grouped with fatal errors?
>
> Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>