net.sf.saxon
Class StandardErrorListener

java.lang.Object
  extended bynet.sf.saxon.StandardErrorListener
All Implemented Interfaces:
javax.xml.transform.ErrorListener, java.io.Serializable
Direct Known Subclasses:
XQueryErrorListener, XSLTErrorListener

public class StandardErrorListener
extends java.lang.Object
implements javax.xml.transform.ErrorListener, java.io.Serializable

StandardErrorListener is the standard error handler for XSLT processing errors, used if no other ErrorListener is nominated.

See Also:
Serialized Form

Field Summary
protected  java.io.PrintStream errorOutput
           
 
Constructor Summary
StandardErrorListener()
           
 
Method Summary
 void error(javax.xml.transform.TransformerException exception)
          Receive notification of a recoverable error.
 void fatalError(javax.xml.transform.TransformerException exception)
          Receive notification of a non-recoverable error.
 java.io.PrintStream getErrorOutput()
          Get the error output stream
static java.lang.String getExpandedMessage(javax.xml.transform.TransformerException err)
          Get a string containing the message for this exception and all contained exceptions
static java.lang.String getLocationMessage(javax.xml.transform.TransformerException err)
          Get a string identifying the location of an error.
 int getRecoveryPolicy()
          Get the recovery policy
 StandardErrorListener makeAnother(int hostLanguage)
          Make a clean copy of this ErrorListener.
 void setErrorOutput(java.io.PrintStream writer)
          Set output destination for error messages (default is System.err)
 void setRecoveryPolicy(int policy)
          Set the recovery policy
 void warning(javax.xml.transform.TransformerException exception)
          Receive notification of a warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorOutput

protected transient java.io.PrintStream errorOutput
Constructor Detail

StandardErrorListener

public StandardErrorListener()
Method Detail

makeAnother

public StandardErrorListener makeAnother(int hostLanguage)
Make a clean copy of this ErrorListener. This is necessary because the standard error listener is stateful (it remembers how many errors there have been)


setErrorOutput

public void setErrorOutput(java.io.PrintStream writer)
Set output destination for error messages (default is System.err)

Parameters:
writer - The PrintStream to use for error messages

getErrorOutput

public java.io.PrintStream getErrorOutput()
Get the error output stream


setRecoveryPolicy

public void setRecoveryPolicy(int policy)
Set the recovery policy


getRecoveryPolicy

public int getRecoveryPolicy()
Get the recovery policy


warning

public void warning(javax.xml.transform.TransformerException exception)
             throws javax.xml.transform.TransformerException
Receive notification of a warning.

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.

Specified by:
warning in interface javax.xml.transform.ErrorListener
Parameters:
exception - The warning information encapsulated in a transformer exception.
Throws:
javax.xml.transform.TransformerException - if the application chooses to discontinue the transformation.
See Also:
TransformerException

error

public void error(javax.xml.transform.TransformerException exception)
           throws javax.xml.transform.TransformerException
Receive notification of a recoverable error.

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

Specified by:
error in interface javax.xml.transform.ErrorListener
Parameters:
exception - The error information encapsulated in a transformer exception.
Throws:
javax.xml.transform.TransformerException - if the application chooses to discontinue the transformation.
See Also:
TransformerException

fatalError

public void fatalError(javax.xml.transform.TransformerException exception)
                throws javax.xml.transform.TransformerException
Receive notification of a non-recoverable error.

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.

Specified by:
fatalError in interface javax.xml.transform.ErrorListener
Parameters:
exception - The error information encapsulated in a transformer exception.
Throws:
javax.xml.transform.TransformerException - if the application chooses to discontinue the transformation.
See Also:
TransformerException

getLocationMessage

public static java.lang.String getLocationMessage(javax.xml.transform.TransformerException err)
Get a string identifying the location of an error.


getExpandedMessage

public static java.lang.String getExpandedMessage(javax.xml.transform.TransformerException err)
Get a string containing the message for this exception and all contained exceptions