com.verisign.epp.util
Class TestErrorHandler

java.lang.Object
  extended by com.verisign.epp.util.TestErrorHandler
All Implemented Interfaces:
org.xml.sax.ErrorHandler

public class TestErrorHandler
extends java.lang.Object
implements org.xml.sax.ErrorHandler

Implementation of the SAX ErrorHandler to report errors parsing an XML document and to throw a SAXException so that the parsing stops on any errors or warnings.


Constructor Summary
TestErrorHandler()
          Default TestErrorHandler constructor, which sets the default output to System.err.
TestErrorHandler(java.io.OutputStream aOut)
          Allocate a TestErrorHandler with a destination OutputStream for the error messages.
 
Method Summary
 void error(org.xml.sax.SAXParseException aException)
          Handle parser error.
 void fatalError(org.xml.sax.SAXParseException aException)
          Handle parser fatal error.
 java.lang.String getErrorString(java.lang.String aLevel, org.xml.sax.SAXParseException aException)
          Format a String message that includes the level of the error, the system id, the line number of the error, the column number of the error, and the error message.
 void warning(org.xml.sax.SAXParseException aException)
          Handle parser warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestErrorHandler

public TestErrorHandler()
Default TestErrorHandler constructor, which sets the default output to System.err.


TestErrorHandler

public TestErrorHandler(java.io.OutputStream aOut)
Allocate a TestErrorHandler with a destination OutputStream for the error messages.

Parameters:
aOut - Stream to write error message to
Method Detail

error

public void error(org.xml.sax.SAXParseException aException)
           throws org.xml.sax.SAXException
Handle parser error. The error will be written to either the default output stream of System.err or the output stream specified in TestErrorHandler(OutputStream). A SAXException is thrown to ensure that the processing of the XML document stops.

Specified by:
error in interface org.xml.sax.ErrorHandler
Parameters:
aException - parser error exception
Throws:
org.xml.sax.SAXException - Exception containing a formatted message of the error

warning

public void warning(org.xml.sax.SAXParseException aException)
             throws org.xml.sax.SAXException
Handle parser warning. The warning will be written to either the default output stream of System.err or the output stream specified in TestErrorHandler(OutputStream). A SAXException is thrown to ensure that the processing of the XML document stops.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Parameters:
aException - parser warning exception
Throws:
org.xml.sax.SAXException - Exception containing a formatted message of the warning

fatalError

public void fatalError(org.xml.sax.SAXParseException aException)
                throws org.xml.sax.SAXException
Handle parser fatal error. The fatal error will be written to either the default output stream of System.err or the output stream specified in TestErrorHandler(OutputStream). A SAXException is thrown to ensure that the processing of the XML document stops.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Parameters:
aException - parser fatal error exception
Throws:
org.xml.sax.SAXException - Exception containing a formatted message of the fatal error

getErrorString

public java.lang.String getErrorString(java.lang.String aLevel,
                                       org.xml.sax.SAXParseException aException)
Format a String message that includes the level of the error, the system id, the line number of the error, the column number of the error, and the error message.

Parameters:
aLevel - Level of the error ("Warning", "Error", or "Fatal Error").
aException - parser error exception
Returns:
DOCUMENT ME!


Copyright © VeriSign Inc. All Rights Reserved.