Hallo David,

thank you for your interesting question.

In our application we use an error buffer to store exceptions that have
been thrown
in the extension functions.

You may consider something like the following. It's rather a brute force
attempt.

1.   Create a singelton that is essentially a map of exception buffers.

2.   Before one transformation is started a unique id and an exception
buffer A is created and A is registered in the map, using the id as a key.

3.   The id is passed to the xslt-script as a parameter.

4.   The id becomes a parameter of the extension function. This function
writes the exception into the specific exception buffer A via the
singelton,
     using the id.

5.   Using this id an additional extension function could check, via the
singelton, if the exception buffer A contains an exception.

6.   After the transformation release the exception buffer A.

Perhaps it is better for your application to use the return value of the
extension function to report the
script about error situations, see
http://xml.apache.org/xalan-j/extensions.html

Andreas Rulle

---------------------- Weitergeleitet am 02.12.2005 09:27
---------------------------

An:    <xalan-j-users@xml.apache.org>
Kopie:
Thema: Throwing exceptions in Xalan Java extension functions

In a Java extension function, what is reasonable to do if the code
throws an exception?It's easy enough to add a catch block and do nothing
with it, or log it in an application-specific log, but is there
something appropriate that should be done knowing that it's a Xalan Java
extension function?  Is there an appropriate wrapper exception I should
be throwing?









Reply via email to