----- Original Message -----From: Michael KaySent: Tuesday, February 03, 2009 4:08 PMSubject: Re: [saxon] throw SAXException from XMLFilterImpl?The exception handling varies from one XML parser to another. When you throw an exception from a callback method, there is no guarantee that the parser will exit from the parse() method with the same exception, or even with your exception as the underlying cause. Nor is it 100% predictable whether the parser will pass your exception to the ErrorHandler. If you need to get information back from your callback method to the application that called parse(), I would advise using some mechanism other than the exception object. (Or, as well as throwing the exception, save it somewhere where the calling application can find it.)I agree it would be cleaner if the code at line 415 wrapped the returned SAXException. I added this code to catch some buggy behaviour by the JDK 1.6 parser, which was throwing an exception without first calling the error handler, and I guess this path hasn't been exercised enough for the problem to arise. (I advise everyone against using the built-in parser in JDK 1.6 anyway, it has some much nastier bugs than this.)Michael Kay
From: Adam Retter [mailto:Adam.Retter@landmark.co.uk]
Sent: 02 February 2009 15:08
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: [saxon] throw SAXException from XMLFilterImpl?
I am using Saxon 126.96.36.199 with Java 6 on Windows XP.
I have an XMLFilterImpl from which I wish to be able to abort processing of the input document under certain circumstances, I then wish to log this event.
I have extended SAXException with my own exception class SkipProcessingException, which I throw from XMLFilterImpl.endElement() under certain circumstances.
For my transform I have something like –
if(xpe.getException() instanceof SkipProcessingException)
//log that we skipped this one
I am unable to get back details of my SkipProcessingException, looking at line 413 of net.sf.saxon.event.Sender, I am wondering why it is that in the first case it doesn’t reference the SAXException (line 415) and in the second case it does line 418.
Is there something that I can do, so that I can receive the underlying SAXException from the XPathException?
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
saxon-help mailing list archived at http://saxon.markmail.org/