The built-in parser in JDK 1.5 seems perfectly OK; if using JDK 1.6, install Xerces 2.9.1 from Apache
 
Michael Kay
http://www.saxonica.com/


From: David A. Lee [mailto:dlee@calldei.com]
Sent: 03 February 2009 21:27
To: Mailing list for the SAXON XSLT and XQuery processor
Cc: Adam.Retter@landmark.co.uk
Subject: Re: [saxon] throw SAXException from XMLFilterImpl?

". (I advise everyone against using the built-in parser in JDK 1.6 anyway, it has some much nastier bugs than this.)"
 
what is your recommended parser ?
 
----- Original Message -----
From: Michael Kay
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Cc: Adam.Retter@landmark.co.uk
Sent: Tuesday, February 03, 2009 4:08 PM
Subject: 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
http://www.saxonica.com/


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 9.1.0.3 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 –

 

try

{

transformer.transform(…)

}

Catch(XPathException xpe)

{

            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?

 

Thanks Adam.


------------------------------------------------------------------------------
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/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help