public class XTFSaxonErrorListener
extends Object
implements ErrorListener
Modifier and Type | Field and Description |
---|---|
private static ThreadLocal<ArrayList<String>> |
threadErrors |
Constructor and Description |
---|
XTFSaxonErrorListener() |
Modifier and Type | Method and Description |
---|---|
static void |
clearThreadErrors()
Clear the thread-specific list of Saxon errors that have occurred.
|
void |
error(TransformerException exception)
Receive notification of a recoverable error.
|
void |
fatalError(TransformerException exception)
Receive notification of a non-recoverable error.
|
static String |
getExpandedMessage(TransformerException err)
Get a string containing the message for this exception and all contained exceptions
|
private static String |
getInstructionName(InstructionInfoProvider inst,
XPathContext context)
Extract a name identifying the instruction at which an error occurred
|
private static String |
getLocationMessage(SourceLocator loc,
XPathContext context) |
static String |
getLocationMessage(TransformerException err)
Get a string identifying the location of an error.
|
static String[] |
getThreadErrors()
Retrieve an array of the Saxon errors that have occurred in the current thread
since the last call to
clearThreadErrors() |
void |
warning(TransformerException exception)
Receive notification of a warning.
|
private static String |
wordWrap(String message)
Wordwrap an error message into lines of 72 characters or less (if possible)
|
public void warning(TransformerException exception) throws TransformerException
Transformers can use this method to report conditions that are not errors or fatal errors. The default behaviour is to take no action.
After invoking this method, the Transformer must continue with the transformation. It should still be possible for the application to process the document through to the end.
warning
in interface ErrorListener
exception
- The warning information encapsulated in a
transformer exception.TransformerException
- if the application
chooses to discontinue the transformation.TransformerException
public void error(TransformerException exception) throws TransformerException
The transformer must continue to provide normal parsing events after invoking this method. It should still be possible for the application to process the document through to the end.
The action of the standard error listener depends on the recovery policy that has been set, which may be one of RECOVER_SILENTLY, RECOVER_WITH_WARNING, or DO_NOT_RECOVER
error
in interface ErrorListener
exception
- The error information encapsulated in a
transformer exception.TransformerException
- if the application
chooses to discontinue the transformation.TransformerException
public void fatalError(TransformerException exception) throws TransformerException
The application must assume that the transformation cannot continue after the Transformer has invoked this method, and should continue (if at all) only to collect addition error messages. In fact, Transformers are free to stop reporting events once this method has been invoked.
fatalError
in interface ErrorListener
exception
- The error information encapsulated in a
transformer exception.TransformerException
- if the application
chooses to discontinue the transformation.TransformerException
public static String getLocationMessage(TransformerException err)
public static String[] getThreadErrors()
clearThreadErrors()
public static void clearThreadErrors()
private static String getLocationMessage(SourceLocator loc, XPathContext context)
public static String getExpandedMessage(TransformerException err)
private static String getInstructionName(InstructionInfoProvider inst, XPathContext context)
private static String wordWrap(String message)