You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by R_KNOWLES <Ri...@reuters.com> on 2000/10/23 18:10:35 UTC

(Xalan-J 1.2) problems with XMLParserLiason ErrorHandler

Hi,

I have identified a problem when I throw an exception from an XMLParserLiason
instance.

I am trying to reuse a compiled stylesheet to process a number of XML
documents, and produce new XML. The parser has an Error Handler attached to
report on any failures.

If the first document being processed causes an exception to be thrown from the
ErrorHandler then the second document will fail to be processed.

I am calling reset on both the XMLParserLiason and the XSLTProcessor between
the two transformations, however this makes no difference.

Is there something else I need to do to reset the parser after a failed
transformation, or is this a bug?

I have attached all the files needed for a small test program (2 java classes,
2 input XML documents, the stylesheet and a dtd).

Any help is very gratefully received.

Thanks
Richard.

-----------------------------------------------------------------
        Visit our Internet site at http://www.reuters.com

Any views expressed in this message are those of  the  individual
sender,  except  where  the sender specifically states them to be
the views of Reuters Ltd.

Re: (Xalan-J 1.2) problems with XMLParserLiason ErrorHandler

Posted by Gary L Peskin <ga...@firstech.com>.
R_KNOWLES wrote:
> 
> Hi,
> 
> I have identified a problem when I throw an exception from an XMLParserLiason
> instance.
> 
> I am trying to reuse a compiled stylesheet to process a number of XML
> documents, and produce new XML. The parser has an Error Handler attached to
> report on any failures.
> 
> If the first document being processed causes an exception to be thrown from the
> ErrorHandler then the second document will fail to be processed.
> 
> I am calling reset on both the XMLParserLiason and the XSLTProcessor between
> the two transformations, however this makes no difference.
> 
> Is there something else I need to do to reset the parser after a failed
> transformation, or is this a bug?
> 
> I have attached all the files needed for a small test program (2 java classes,
> 2 input XML documents, the stylesheet and a dtd).
> 
> Any help is very gratefully received.
> 

Richard --

I have good news and bad news on this.  First of all, your description
of the problem and the attached files were very helpful.  Thank you.

The problem is due to a bug in XMLValidator, which is part of the Xerces
package.  Certain tables in the validator are not refreshed when a new
validator is obtained.  One of those is the table of id attributes. 
Since both Input1.xml and Input2.xml have the same value for the id
attribute, Xerces thought this was a duplicate id attribute and
generated your second error even though nothing was really wrong with
Input2.xml.

The good news is that the bug is fixed in the latest version of Xerces
which is 1.2.1.  The bad news is that Xalan 1.2.0 won't run with Xerces
1.2.1 due to an IncompatibleClassChange exception.

The best thing would be for you to download Xerces 1.2.1 and then
rebuild Xalan 1.2.0 from the source.  This should fix your problem which
is not really your problem at all.

I did the following and I'm cautioning you that this is NOT
recommended.  I downloaded Xerces 1.2.1.  Then, I extracted the
XMLValidator classes.  There are a whole bunch of .class files because
XMLValidator has a lot of inner classes.  Then, I added the XMLValidator
classes into the Xerces 1.2.0 jar, replacing the 1.2.0 versions of
XMLValidator.  This fixed the problem.

Again, I DO NOT recommend this approach.  Building Xalan 1.2.0 from the
source with the new Xerces jar is by far the safer approach.  If you
have problems that surface when you are recompiling, please let us know
and we'll see if we can fix Xalan 1.2.0 for the new Xerces jar.

I did want to let you know that this was not your problem but that you
stumbled across this recently fixed Xerces bug.

Gary