Subject: Re: [xsl] Xalan, errors and ErrorListener From: Myriam_Midy@xxxxxxxxx Date: Thu, 9 Aug 2001 16:32:55 -0400 |
I am forwarding this question to the xalan list where it really belongs and one of us will take a look at it. Hopefully you are subscribed to the xalan list (xalan-dev@xxxxxxxxxxxxxx). Myriam Mike Brown <mike@xxxxxxxx> Sent by: To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx owner-xsl-list@xxxxxxxxxxxx cc: sboag@xxxxxxxxxx, (bcc: Myriam rytech.com Midy/CAM/Lotus) Subject: [xsl] Xalan, errors and ErrorListener 08/09/01 04:12 PM Please respond to xsl-list I'm using Xalan 2.2.D6, trying to use my own ErrorListener to nicely format problems encountered during stylesheet preparation. I register an instance of the ErrorListener implementation with the TransformerFactory, and then I call the factory's newTemplates method to get the prepared stylesheet. My stylesheet intentionally contains a bad attribute name in an <xsl:template> start tag, causing the ErrorListener's error method to be invoked. Both my error and fatalError methods prepare a formatted String using info in the TransformerException that is passed into them, and then they throw a new TransformerException that contains only this String as its message. Apparently this isn't a very good way to go about it because Xalan's StylesheetHandler class catches this new TransformerException, wraps it in a SAXException, which gets thrown and makes its way up to the TransformerFactoryImpl which blindly takes it as a random parsing error. It then gets wrapped in a new TransformerException, which is passed to the ErrorListener's fatalError method. I tried to look at TransformerFactoryImpl and StylesheetHandler but couldn't figure out how it avoids an infinite loop of passing the exception back and forth between the factory's newTemplates method and my fatalError method. Yet somehow we get out of it and in the end I get a TransformerException with a message saying something along the lines of "There was a fatal error. Here it is: There was an error. Here it is: (...)". If Xalan's behavior is reasonable, I don't see how I can easily write my ErrorListener implementation to distinguish between an error and a fatal error. The fatal error might actually be a regular error that has already been reported. Is this really the way it should work? - Mike ____________________________________________________________________________ mike j. brown, fourthought.com | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | personal: http://hyperreal.org/~mike/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Xalan, errors and ErrorListen, Mike Brown | Thread | [xsl] Currency Localization, Tim Watts |
Re: [xsl] Using XSLT for Searching, Thomas B. Passin | Date | Re: [xsl] xalan-j2 D7: StreamSource, Scott_Boag |
Month |