You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Mark Weaver <ma...@npsl.co.uk> on 2004/04/27 18:43:01 UTC

ProblemListener problem

I'm trying to trap all errors produced by Xalan using a problem listener.
The problem is that this misses errors that get thrown as exceptions
sometimes.  I _think_ but I'm not sure (this is only from experimentation)
that this only happens if an extension functions throws the error.
Generally, these are caught in XalanTransformer and formatted up nicely, but
I really want access to the raw line/column data for syntax highlighting
purposes, without having to parse strings (which anyway could be duplicates
of what has been passed to my problem listener).

Currently I've taken the approach that it's better that to duplicate rather
than miss the errors, so in my (somewhat customised) copy of
XalanTransformer, where the exceptions are caught, I punt these on to the
problem listener.  This does, in general, lead to most errors being reported
twice though.  Can anyone see a way that I can avoid this?

Thanks,

Mark


RE: ProblemListener problem

Posted by Mark Weaver <ma...@npsl.co.uk>.
> I'm trying to trap all errors produced by Xalan using a problem listener.
> The problem is that this misses errors that get thrown as exceptions
> sometimes.  I _think_ but I'm not sure (this is only from experimentation)
> that this only happens if an extension functions throws the error.
> Generally, these are caught in XalanTransformer and formatted up
> nicely, but
> I really want access to the raw line/column data for syntax highlighting
> purposes, without having to parse strings (which anyway could be
> duplicates
> of what has been passed to my problem listener).
>
> Currently I've taken the approach that it's better that to
> duplicate rather
> than miss the errors, so in my (somewhat customised) copy of
> XalanTransformer, where the exceptions are caught, I punt these on to the
> problem listener.  This does, in general, lead to most errors
> being reported
> twice though.  Can anyone see a way that I can avoid this?
>
There is one _obvious_ way I missed (!)

if (line == && col ==...)

Not the most elegant solution in the book, but it does work :)