[xml] improved xslt error handling?



I have quite a complex xslt based app that I will soon be releasing to
the world.

It's a multiuser webapp, based on libxslt. Users can plugin their own
xslts to a framework allowing all sorts of web2.0-y type websites:
blogs, planets, etc...

One of the areas where my app doesn't work well right now is error
handling. That's because the only error handling I know about with
libxslt is the libxslt error handler.

There are two reasons why the current error handler is now really good
enough for me:

- it hardly ever provides enough information about the error

- it is not process specific - there is only one error log and no
  contextual way to separate one thread's errors from another thread's


I'd like to do something about this in the near term. 

Three solutions immediately suggest themselves:

- allow an error handler to be set against a particular stylesheet and
  somehow alter the xslt engine code to use that error handler

- allow a per-thread context to be passed to the error handler, say a
  transform context; you'd have to register the error handler in a
  special way to get the extra-argument,; in python say:

    def error_handler(ctx, pctx, error_message):
        global error_messages
        error_messages[pctx].add(error_message)

    libxslt.registerContextErrorHandler(error_handler_func, "")

- allow real per-thread error handlers, setting an error handler in
  the per-thread data space and checking for it's existance before
  logging an error


Anybody care to shoot holes in these ideas?

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   for all your tapsell ferrier needs



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]