net.sf.saxon.lib
Class StandardErrorHandler

java.lang.Object
  extended by net.sf.saxon.lib.StandardErrorHandler
All Implemented Interfaces:
ErrorHandler

public class StandardErrorHandler
extends Object
implements ErrorHandler

A default implementation of the SAX ErrorHandler interface. Used by Saxon to catch XML parsing errors if no error handler is supplied by the application.


Constructor Summary
StandardErrorHandler(ErrorListener listener)
           
 
Method Summary
 void error(SAXParseException e)
          Callback interface for SAX: not for application use
 void fatalError(SAXParseException e)
          Callback interface for SAX: not for application use
 int getErrorCount()
          Return the number of errors reported
 int getFatalErrorCount()
          Return the number of fatal errors reported
 int getWarningCount()
          Return the number of warnings (including warnings) reported
protected  void reportError(SAXParseException e, boolean isFatal)
          Common routine for SAX errors and fatal errors
 void setErrorOutput(Writer writer)
          Set output for error messages produced by the default error handler.
 void warning(SAXParseException e)
          Callback interface for SAX: not for application use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardErrorHandler

public StandardErrorHandler(ErrorListener listener)
Method Detail

setErrorOutput

public void setErrorOutput(Writer writer)
Set output for error messages produced by the default error handler. The default error handler does not throw an exception for parse errors or input I/O errors, rather it returns a result code and writes diagnostics to a user-specified output writer, which defaults to System.err
This call has no effect if setErrorHandler() has been called to supply a user-defined error handler

Parameters:
writer - The Writer to use for error messages

warning

public void warning(SAXParseException e)
Callback interface for SAX: not for application use

Specified by:
warning in interface ErrorHandler

error

public void error(SAXParseException e)
           throws SAXException
Callback interface for SAX: not for application use

Specified by:
error in interface ErrorHandler
Throws:
SAXException

fatalError

public void fatalError(SAXParseException e)
                throws SAXException
Callback interface for SAX: not for application use

Specified by:
fatalError in interface ErrorHandler
Throws:
SAXException

reportError

protected void reportError(SAXParseException e,
                           boolean isFatal)
Common routine for SAX errors and fatal errors

Parameters:
e - the exception being handled
isFatal - true if the error is classified as fatal

getWarningCount

public int getWarningCount()
Return the number of warnings (including warnings) reported

Returns:
the number of warnings

getErrorCount

public int getErrorCount()
Return the number of errors reported

Returns:
the number of non-fatal errors

getFatalErrorCount

public int getFatalErrorCount()
Return the number of fatal errors reported

Returns:
the number of fatal errors


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.