You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Maitreyee Pasad <pa...@gst.com> on 2000/08/17 20:57:02 UTC

Not throwing Exception for fatal errors.

I am using xerces 1_0_1, and SAX2 interface.

I have an entity declaration

<!ELEMENT E1 (X|Y) >

which should imply that I can either have one instance X or Y element
under E1.

But in my xml I have

<E1>
   <X> .... </X>
   <Y> .... </Y>
</E1>

Should the parser throw a fatal error?

I have set the parser feature "httP//xml.org/sax/validation" to true.

I have not overloaded any error handling methods.

Since this didn't work I switched to xerces 1_1_2 and tried to add
fatalError method in my class (say S1 ) that extends ContentHandler
class
to print the stackTrace.

But it doesn't get called atall.

This same xml I also pass throug xalan version 1.2 and it does recognize
the error but ofcourse there is no way for me to catch the
errors from xalan.

I need to catch these errors. What am I missing?

Thanks.

Maitreyee



Re: Not throwing Exception for fatal errors.

Posted by Maitreyee Pasad <pa...@gst.com>.
My test Environment is giving the file not found exception. So I couldn't test
the Error Handler. But my
in my development area it is working. The exceptions are being thrown.
Thanks.

Maitreyee

Maitreyee Pasad wrote:

> I created that class, but now my program gives another error.
>
> It says the test1.xml file is not found. This file is in the same directory
> that I am running my program from.
> All the test classes that I have created and am using are in the same
> directory. I know this doesn't
> seem to be a problem that I should ask your help from but I was wondering if
> nay of you have had similar problems.
>
> Thanks.
>
> Maitreyee
>
> rsanford wrote:
>
> > you need to create an object that implements the ErrorHandler
> > interface and call setErrorHandler on your parser.
> >
> > rjsjr
> >
> > > -----Original Message-----
> > > From: Maitreyee Pasad [mailto:pasad@gst.com]
> > > Sent: Thursday, August 17, 2000 1:57 PM
> > > To: xerces-j-dev@xml.apache.org
> > > Subject: Not throwing Exception for fatal errors.
> > >
> > >
> > >
> > > I am using xerces 1_0_1, and SAX2 interface.
> > >
> > > I have an entity declaration
> > >
> > > <!ELEMENT E1 (X|Y) >
> > >
> > > which should imply that I can either have one instance X or Y element
> > > under E1.
> > >
> > > But in my xml I have
> > >
> > > <E1>
> > >    <X> .... </X>
> > >    <Y> .... </Y>
> > > </E1>
> > >
> > > Should the parser throw a fatal error?
> > >
> > > I have set the parser feature "httP//xml.org/sax/validation" to true.
> > >
> > > I have not overloaded any error handling methods.
> > >
> > > Since this didn't work I switched to xerces 1_1_2 and tried to add
> > > fatalError method in my class (say S1 ) that extends ContentHandler
> > > class
> > > to print the stackTrace.
> > >
> > > But it doesn't get called atall.
> > >
> > > This same xml I also pass throug xalan version 1.2 and it does recognize
> > > the error but ofcourse there is no way for me to catch the
> > > errors from xalan.
> > >
> > > I need to catch these errors. What am I missing?
> > >
> > > Thanks.
> > >
> > > Maitreyee
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: Not throwing Exception for fatal errors.

Posted by Maitreyee Pasad <pa...@gst.com>.
I created that class, but now my program gives another error.

It says the test1.xml file is not found. This file is in the same directory
that I am running my program from.
All the test classes that I have created and am using are in the same
directory. I know this doesn't
seem to be a problem that I should ask your help from but I was wondering if
nay of you have had similar problems.

Thanks.

Maitreyee

rsanford wrote:

> you need to create an object that implements the ErrorHandler
> interface and call setErrorHandler on your parser.
>
> rjsjr
>
> > -----Original Message-----
> > From: Maitreyee Pasad [mailto:pasad@gst.com]
> > Sent: Thursday, August 17, 2000 1:57 PM
> > To: xerces-j-dev@xml.apache.org
> > Subject: Not throwing Exception for fatal errors.
> >
> >
> >
> > I am using xerces 1_0_1, and SAX2 interface.
> >
> > I have an entity declaration
> >
> > <!ELEMENT E1 (X|Y) >
> >
> > which should imply that I can either have one instance X or Y element
> > under E1.
> >
> > But in my xml I have
> >
> > <E1>
> >    <X> .... </X>
> >    <Y> .... </Y>
> > </E1>
> >
> > Should the parser throw a fatal error?
> >
> > I have set the parser feature "httP//xml.org/sax/validation" to true.
> >
> > I have not overloaded any error handling methods.
> >
> > Since this didn't work I switched to xerces 1_1_2 and tried to add
> > fatalError method in my class (say S1 ) that extends ContentHandler
> > class
> > to print the stackTrace.
> >
> > But it doesn't get called atall.
> >
> > This same xml I also pass throug xalan version 1.2 and it does recognize
> > the error but ofcourse there is no way for me to catch the
> > errors from xalan.
> >
> > I need to catch these errors. What am I missing?
> >
> > Thanks.
> >
> > Maitreyee
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


RE: Not throwing Exception for fatal errors.

Posted by rsanford <rs...@nolimitsystems.com>.
you need to create an object that implements the ErrorHandler 
interface and call setErrorHandler on your parser.

rjsjr

> -----Original Message-----
> From: Maitreyee Pasad [mailto:pasad@gst.com]
> Sent: Thursday, August 17, 2000 1:57 PM
> To: xerces-j-dev@xml.apache.org
> Subject: Not throwing Exception for fatal errors.
> 
> 
> 
> I am using xerces 1_0_1, and SAX2 interface.
> 
> I have an entity declaration
> 
> <!ELEMENT E1 (X|Y) >
> 
> which should imply that I can either have one instance X or Y element
> under E1.
> 
> But in my xml I have
> 
> <E1>
>    <X> .... </X>
>    <Y> .... </Y>
> </E1>
> 
> Should the parser throw a fatal error?
> 
> I have set the parser feature "httP//xml.org/sax/validation" to true.
> 
> I have not overloaded any error handling methods.
> 
> Since this didn't work I switched to xerces 1_1_2 and tried to add
> fatalError method in my class (say S1 ) that extends ContentHandler
> class
> to print the stackTrace.
> 
> But it doesn't get called atall.
> 
> This same xml I also pass throug xalan version 1.2 and it does recognize
> the error but ofcourse there is no way for me to catch the
> errors from xalan.
> 
> I need to catch these errors. What am I missing?
> 
> Thanks.
> 
> Maitreyee
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>