com.novell.xsl
Class DefaultErrorHandler

java.lang.Object
  extended bycom.novell.xsl.DefaultErrorHandler
All Implemented Interfaces:
ErrorHandler

public class DefaultErrorHandler
extends Object
implements ErrorHandler

Default XSL error handler that logs errors and warnings to a PrintWriter (System.err unless specified otherwise).


Constructor Summary
DefaultErrorHandler()
          Constructs a default error handler that logs errors and warnings to System.err.
DefaultErrorHandler(PrintWriter output)
          Constructs a default error handler that logs errors and warnings to the specified PrintWriter.
 
Method Summary
 void error(String message)
          Receive notification of an XSL error.
 int getErrorCount()
          Returns the number of errors that have occurred so far.
 int getWarningCount()
          Returns the number of warnings that have occurred so far.
 void resetCounts()
          Resets the number of errors and warnings to zero.
 void setLogErrors(boolean logErrors)
          Sets whether errors are to be logged.
 void setLogWarnings(boolean logWarnings)
          Sets whether warnings are to be logged.
 void warning(String message)
          Receive notification of an XSL warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultErrorHandler

public DefaultErrorHandler()
Constructs a default error handler that logs errors and warnings to System.err.


DefaultErrorHandler

public DefaultErrorHandler(PrintWriter output)
Constructs a default error handler that logs errors and warnings to the specified PrintWriter.

Parameters:
output - the PrintWriter to which error messages are logged
Method Detail

getErrorCount

public int getErrorCount()
Returns the number of errors that have occurred so far.

Specified by:
getErrorCount in interface ErrorHandler
Returns:
the number of errors

getWarningCount

public int getWarningCount()
Returns the number of warnings that have occurred so far.

Specified by:
getWarningCount in interface ErrorHandler
Returns:
the number of warnings

resetCounts

public void resetCounts()
Resets the number of errors and warnings to zero.

Specified by:
resetCounts in interface ErrorHandler

setLogErrors

public void setLogErrors(boolean logErrors)
Sets whether errors are to be logged. By default, errors are logged.

Parameters:
logErrors - true if errors are to be logged

setLogWarnings

public void setLogWarnings(boolean logWarnings)
Sets whether warnings are to be logged. By default, warnings are logged.

Parameters:
logWarnings - true if warnings are to be logged

error

public void error(String message)
           throws XSLException
Receive notification of an XSL error. If errors are being logged, the error message is written to the log. Regardless, this implementation always returns normally, allowing the XSL processor to recover and continue processing.

Specified by:
error in interface ErrorHandler
Parameters:
message - the error message
Throws:
XSLException - if the error is fatal (never thrown by this implementation)

warning

public void warning(String message)
Receive notification of an XSL warning. If warnings are being logged, the warning message is written to the log.

Specified by:
warning in interface ErrorHandler
Parameters:
message - the warning message