[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Xalan, errors and ErrorListener
Subject: [xsl] Xalan, errors and ErrorListener From: Mike Brown <mike@xxxxxxxx> Date: Thu, 9 Aug 2001 14:12:32 -0600 (MDT) |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xalan-j2 D7: StreamSource, Myriam_Midy | Thread | Re: [xsl] Xalan, errors and ErrorLi, Myriam_Midy |
Re: [xsl] xalan-j2 D7: StreamSource, Robert Koberg | Date | Re: [xsl] URL escaping in HTML outp, Mike Brown |
Month |