[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xalan-c-users
Subject:    RE: Xalan 1.3/1.4 behvior change when compiling a stylesheet
From:       david_n_bertoni () us ! ibm ! com
Date:       2002-12-03 22:59:09
Message-ID: OF2F911AD5.5CB9A094-ON88256C84.007CED8E-88256C84.007E4430 () lotus ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Thomas,

If you want to stop parsing using SAX, you must throw an exception.  Fr=
om
the SAX documentation:

   "WARNING: If an application does not register an ErrorHandler, XML
   parsing errors will go unreported, except that SAXParseExceptions wi=
ll
   be thrown for fatal errors. In order to detect validity errors, an
   ErrorHandler that does something with error() calls must be register=
ed."

   "For XML processing errors, a SAX driver must use this interface in
   preference to throwing an exception: it is up to the application to
   decide whether to throw an exception for different types of errors a=
nd
   warnings. Note, however, that there is no requirement that the parse=
r
   continue to report additional errors after a call to fatalError. In
   other words, a SAX driver class may throw an exception after reporti=
ng
   any fatalError. Also parsers may throw appropriate exceptions for
   non-XML errors. For example, XMLReader.parse() would throw an
   IOException for errors accessing entities or the document."

Note that a parser _can_ continue after reporting a fataError, although=

it's not required that it do so.

If you don't throw an exception, Xalan will never know that an error
occurred, so an error code will not be returned.  If you want to collec=
t
all of the error messages, then report them, you'll be responsible for
determining if processing was successful or not.  As long as you're doi=
ng
separate compilation of the stylesheet, and parsing of the source docum=
ent,
that's OK.

However, if your error handler doesn't do the right thing, the results =
are
undefined if you try to transform with a stylesheet that with a fatal
error.  The same can be said for the parsed source tree.

Dave



                                                                       =
                                                                       =
  
                      thomas.cherel@ascentials                         =
                                                                       =
  
                      oftware.com                      To:      xalan-c=
-users@xml.apache.org                                                  =
  
                                                       cc:      (bcc: D=
avid N Bertoni/Cambridge/IBM)                                          =
  
                      12/03/2002 02:36 PM              Subject: RE: Xal=
an 1.3/1.4 behvior change when compiling a stylesheet                  =
  
                                                                       =
                                                                       =
  



So it is an absolute (or recommended) behavior for the error handler to=

throw an exception to stop the parse?
I was hoping that we could let the parse continue (not throwing an
exception
in the error handler) in order to collect all the error messages and ju=
st
use a flag to say if any errors occur or not that we check after the
parsing
to see if it was ok or not. May be I should direct such question to the=

Xerces mailing list.

Thomas


-----Original Message-----
From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]=

Sent: Tuesday, December 03, 2002 4:52 PM
To: xalan-c-users@xml.apache.org
Subject: RE: Xalan 1.3/1.4 behvior change when compiling a stylesheet






Hi Thomas,

This sounds like a change in the parser, or a bug fix that exposes
incorrect
behavior on the part of your ErrorHandler derivative.  I suspect what's=

happening is the parser is recovering from the error and continuing. Th=
e
appropriate behavior is for your ErrorHandler to throw some sort of
exception to stop the parse.

Dave





                      thomas.cherel@ascentials

                      oftware.com                      To:
xalan-c-users@xml.apache.org

                                                       cc:      (bcc: D=
avid
N Bertoni/Cambridge/IBM)
                      12/03/2002 11:15 AM              Subject: RE: Xal=
an
1.3/1.4 behvior change when compiling a stylesheet





Thanks for the information.
Actually, we are not throwing an exception from the error handler and t=
his
is probably the issue. In 1.3 it seems that we did not have to
(compileStylesheet was still returning the appropriate success/failure
code), but that was may be already a mistake. We are going to change th=
e
code to throw an exception. If the problem is still not fixed, I will o=
pen
a
bug report.

Thomas


-----Original Message-----
From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com]=

Sent: Tuesday, December 03, 2002 1:48 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Xalan 1.3/1.4 behvior change when compiling a stylesheet






Hi Thomas,

That sounds like a bug.  You are throwing an exception from your
ErrorHandler, right?

This could also be a change in how the parser is handling things.  Are =
you
talking about well-formedness errors in the stylesheet, or perhaps XPat=
h
errors in stylesheet elements?

If you could open a bug report, with a minimal input document and
stylesheet
that reproduce the problem, that would be great.

Dave





                      thomas.cherel@ascentials

                      oftware.com                      To:
xalan-c-users@xml.apache.org

                                                       cc:      (bcc: D=
avid
N Bertoni/Cambridge/IBM)
                      12/03/2002 10:26 AM              Subject: Xalan
1.3/1.4 behvior change when compiling a stylesheet






A quick question in case someone experienced the same problem. If I
configure a XalanTransformer with an error handler and if I compile a
stylesheet, any errors in the stylesheet are reported through the error=

handler. In Xalan 1.3, the return of the compileStylesheet operation wa=
s
also different from 0 (success) in case any errors were reported throug=
h
the
error handler. In Xalan 1.4, it seems that even if some errors are repo=
rted
through the error handler, the return of the compileStylesheet is set t=
o 0
(success). Is it an expected behavior change or should I investigate a
little more to make sure that I am not doing anything wrong?

Thanks.

Thomas


=

[Attachment #5 (text/html)]

<html><body>
<p>Hi Thomas,<br>
<br>
If you want to stop parsing using SAX, you must throw an exception.  From the SAX \
documentation:<br>

<ul>&quot;WARNING: If an application does not register an ErrorHandler, XML parsing \
errors will go unreported, except that SAXParseExceptions will be thrown for fatal \
errors. In order to detect validity errors, an ErrorHandler that does something with \
error() calls must be registered.&quot;<br> <br>
&quot;For XML processing errors, a SAX driver must use this interface in preference \
to throwing an exception: it is up to the application to decide whether to throw an \
exception for different types of errors and warnings. Note, however, that there is no \
requirement that the parser continue to report additional errors after a call to \
fatalError. In other words, a SAX driver class may throw an exception after reporting \
any fatalError. Also parsers may throw appropriate exceptions for non-XML errors. For \
example, XMLReader.parse() would throw an IOException for errors accessing entities \
or the document.&quot;<br> </ul>
Note that a parser _can_ continue after reporting a fataError, although it's not \
required that it do so.<br> <br>
If you don't throw an exception, Xalan will never know that an error occurred, so an \
error code will not be returned.  If you want to collect all of the error messages, \
then report them, you'll be responsible for determining if processing was successful \
or not.  As long as you're doing separate compilation of the stylesheet, and parsing \
of the source document, that's OK.<br> <br>
However, if your error handler doesn't do the right thing, the results are undefined \
if you try to transform with a stylesheet that with a fatal error.  The same can be \
said for the parsed source tree.<br> <br>
Dave<br>
<br>
<img width="16" height="16" src="cid:1__=07BBE617DFEF6B1E8f9e8a93df9386@lotus.com" \
border="0" alt="Inactive hide details for \
thomas.cherel@ascentialsoftware.com">thomas.cherel@ascentialsoftware.com<br> <br>
<br>

<table V5DOTBL=true width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="72" height="1" \
src="cid:2__=07BBE617DFEF6B1E8f9e8a93df9386@lotus.com" border="0" alt=""><br> \
</td><td style="background-image:url(cid:3__=07BBE617DFEF6B1E8f9e8a93df9386@lotus.com); \
background-repeat: no-repeat; " width="1%"><img width="220" height="1" \
src="cid:2__=07BBE617DFEF6B1E8f9e8a93df9386@lotus.com" border="0" alt=""><br>

<ul>
<ul>
<ul>
<ul><b><font size="2">thomas.cherel@ascentialsoftware.com</font></b>
<p><font size="2">12/03/2002 02:36 PM</font></ul>
</ul>
</ul>
</ul>
</td><td width="100%"><img width="1" height="1" \
src="cid:2__=07BBE617DFEF6B1E8f9e8a93df9386@lotus.com" border="0" alt=""><br> <font \
size="1" face="Arial">	</font><br> <font size="2">	To:	</font><font \
size="2">xalan-c-users@xml.apache.org</font><br> <font size="2">	cc:	</font><font \
size="2">(bcc: David N Bertoni/Cambridge/IBM)</font><br> <font \
size="2">	Subject:	</font><font size="2">RE: Xalan 1.3/1.4 behvior change when \
compiling a stylesheet</font></td></tr> </table>
<br>
<tt>So it is an absolute (or recommended) behavior for the error handler to<br>
throw an exception to stop the parse?<br>
I was hoping that we could let the parse continue (not throwing an exception<br>
in the error handler) in order to collect all the error messages and just<br>
use a flag to say if any errors occur or not that we check after the parsing<br>
to see if it was ok or not. May be I should direct such question to the<br>
Xerces mailing list.<br>
<br>
Thomas<br>
<br>
<br>
-----Original Message-----<br>
From: David N Bertoni/Cambridge/IBM [<a \
                href="mailto:david_n_bertoni@us.ibm.com">mailto:david_n_bertoni@us.ibm.com</a>] \
                <br>
Sent: Tuesday, December 03, 2002 4:52 PM<br>
To: xalan-c-users@xml.apache.org<br>
Subject: RE: Xalan 1.3/1.4 behvior change when compiling a stylesheet<br>
<br>
<br>
<br>
<br>
<br>
<br>
Hi Thomas,<br>
<br>
This sounds like a change in the parser, or a bug fix that exposes incorrect<br>
behavior on the part of your ErrorHandler derivative. &nbsp;I suspect what's<br>
happening is the parser is recovering from the error and continuing. The<br>
appropriate behavior is for your ErrorHandler to throw some sort of<br>
exception to stop the parse.<br>
<br>
Dave<br>
<br>
<br>
<br>
 <br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;thomas.cherel@ascentials<br> <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;oftware.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp;To:<br> xalan-c-users@xml.apache.org<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp;(bcc: David<br> N Bertoni/Cambridge/IBM) \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>  &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;12/03/2002 11:15 \
AM &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Subject: RE: Xalan<br> 1.3/1.4 \
behvior change when compiling a stylesheet &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp;<br>  <br>
<br>
<br>
<br>
<br>
Thanks for the information.<br>
Actually, we are not throwing an exception from the error handler and this<br>
is probably the issue. In 1.3 it seems that we did not have to<br>
(compileStylesheet was still returning the appropriate success/failure<br>
code), but that was may be already a mistake. We are going to change the<br>
code to throw an exception. If the problem is still not fixed, I will open a<br>
bug report.<br>
<br>
Thomas<br>
<br>
<br>
-----Original Message-----<br>
From: David N Bertoni/Cambridge/IBM [<a \
                href="mailto:david_n_bertoni@us.ibm.com">mailto:david_n_bertoni@us.ibm.com</a>]<br>
                
Sent: Tuesday, December 03, 2002 1:48 PM<br>
To: xalan-c-users@xml.apache.org<br>
Subject: Re: Xalan 1.3/1.4 behvior change when compiling a stylesheet<br>
<br>
<br>
<br>
<br>
<br>
<br>
Hi Thomas,<br>
<br>
That sounds like a bug. &nbsp;You are throwing an exception from your<br>
ErrorHandler, right?<br>
<br>
This could also be a change in how the parser is handling things. &nbsp;Are you<br>
talking about well-formedness errors in the stylesheet, or perhaps XPath<br>
errors in stylesheet elements?<br>
<br>
If you could open a bug report, with a minimal input document and stylesheet<br>
that reproduce the problem, that would be great.<br>
<br>
Dave<br>
<br>
<br>
<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;thomas.cherel@ascentials<br> <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;oftware.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp;To:<br> xalan-c-users@xml.apache.org<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp;(bcc: David<br> N \
Bertoni/Cambridge/IBM)<br>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp;12/03/2002 10:26 AM &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;Subject: Xalan<br> 1.3/1.4 behvior change when compiling a stylesheet<br>
<br>
<br>
<br>
<br>
<br>
<br>
A quick question in case someone experienced the same problem. If I<br>
configure a XalanTransformer with an error handler and if I compile a<br>
stylesheet, any errors in the stylesheet are reported through the error<br>
handler. In Xalan 1.3, the return of the compileStylesheet operation was<br>
also different from 0 (success) in case any errors were reported through the<br>
error handler. In Xalan 1.4, it seems that even if some errors are reported<br>
through the error handler, the return of the compileStylesheet is set to 0<br>
(success). Is it an expected behavior change or should I investigate a<br>
little more to make sure that I am not doing anything wrong?<br>
<br>
Thanks.<br>
<br>
Thomas<br>
<br>
<br>
</tt><br>
</body></html>


["graycol.gif" (image/gif)]
["ecblank.gif" (image/gif)]
["pic18433.gif" (image/gif)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic