Project

Profile

Help

Patch #1412

closed

exception handling extension

Added by Anonymous over 19 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Internals
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Legacy ID:
sf-1064866
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

SourceForge user: gschadow

Hi Michael, again.

here is an self-consistent extension that adds exception

handling to Saxon 8.1.1. I've done this since Saxon6

through many version of 7 and now for 8.1.1. Have been

using this a lot since then.

The use case is if you work with a database or other

extensions that could throw exceptions and fail. If you

have users depending on this or -- as in my case -- you

have long-running batch jobs, you don't want an

exception to kill you entire process. Example:

<xsl:variable name="documentFromString">

ex:try

<xsl:sequence select="saxon:parse($string)"/>

<ex:catch exception="java.sql.SQLException">

   <invalid/>

</ex:catch>

</ex:try>

</xsl:variable>

<xsl:if test="not($documentFromString/invalid)">

... do the normal thing ...

</xsl:if>

you see, if the $string (e.g., pulled from a database that

stores XML chunks) contains garbage, the process

doesn't fail but has a way to fall back gracefully.

I think the value of this is 100x more important than

the -- excuse me -- skimpy little SQL extension that you

distribute. So, if you might consider adopting this I

would be eternally grateful (even more so than I am

anyway for your making saxon in the first place :-)

If you like me to make one final adaptation to your

coding style (where style and instruction is separated) I

will gladly do that for you on the promise that you will

adopt.

regards,

-Gunther


Files

exception-handling.zip (9.56 KB) exception-handling.zip Anonymous, 2004-12-09 20:48
Actions #1

Updated by Anonymous over 19 years ago

SourceForge user: gschadow

Logged In: YES

user_id=575520

oops, I forgot to attach the patch.

Actions #2

Updated by Michael Kay almost 11 years ago

  • Status changed from New to Closed

Closed. Try/Catch has been available as a Saxon extension for many years, and more recently has become part of the standard XQuery 3.0 and XSLT 3.0 specifications.

Please register to edit this issue

Also available in: Atom PDF