public interface ErrorListener
Transformerto notify callers of error messages that occur during a transformation process. An ErrorListener receives three levels of messages: warnings, errors and fatal errors as classified by their severity. Each of them is handled as described in their respective method.
An ErrorListener instance can be registered to a
method to receive errors and warnings reported by the TransformerFactory
When a listener is registered, the
must use this interface to pass on all warnings and errors to the listener
and let the application decide how to handle them.
Note that the
Transformer is not
required to continue with the transformation after a call to
If an application does not provide a listener, the
Transformer shall create one on its own. The default
may take no action for warnings and recoverable errors, and allow the
transformation to continue.
Transformer may still throw
TransformerException when it decides it can not continue processing.
- API Note:
- It is recommended that applications register and use their own
ErrorListenerto override the default behavior in order to ensure proper handling of warnings and errors.
Modifier and Type Method Description
error(TransformerException exception)Receive notification of a recoverable error.
fatalError(TransformerException exception)Receive notification of a non-recoverable error.
warning(TransformerException exception)Receive notification of a warning.
Receive notification of a warning.
Transformercan 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.
Receive notification of a recoverable error.
The transformer must continue to try and provide normal transformation after invoking this method. It should still be possible for the application to process the document through to the end if no other errors are encountered.
Receive notification of a non-recoverable error.
The processor may choose to continue, but will not normally proceed to a successful completion.
The method should throw an exception if it is unable to process the error, or if it wishes execution to terminate immediately. The processor will not necessarily honor this request.