Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#10 exception handling extension

open
nobody
None
5
2012-10-08
2004-11-11
Gunther Schadow
No

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

Discussion


Anonymous


Cancel   Add attachments