de.bsvrz.sys.funclib.xmlSupport
Class CountingErrorHandler

java.lang.Object
  extended by de.bsvrz.sys.funclib.xmlSupport.CountingErrorHandler
All Implemented Interfaces:
ErrorHandler

public class CountingErrorHandler
extends Object
implements ErrorHandler

Implementierung eines ErrorHandlers, der mit XML-Parsern benutzt werden kann, um evtl. auftretende Fehler beim Parsen einer XML-Datei zu zählen und mit entsprechenden Debug-Ausgaben zu dokumentieren.

Author:
Kappich Systemberatung

Constructor Summary
CountingErrorHandler()
           
 
Method Summary
 void error(SAXParseException e)
          Receive notification of a recoverable parser error.
 void fatalError(SAXParseException e)
          Report a fatal XML parsing error.
 int getErrorCount()
           
 int getWarningCount()
           
 void printSummary()
           
 void warning(SAXParseException e)
          Receive notification of a parser warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountingErrorHandler

public CountingErrorHandler()
Method Detail

warning

public void warning(SAXParseException e)
             throws SAXException
Receive notification of a parser warning.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each warning, such as inserting the message in a log file or printing it to the console.

Specified by:
warning in interface ErrorHandler
Parameters:
e - The warning information encoded as an exception.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException), SAXParseException

error

public void error(SAXParseException e)
           throws SAXException
Receive notification of a recoverable parser error.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each error, such as inserting the message in a log file or printing it to the console.

Specified by:
error in interface ErrorHandler
Parameters:
e - The warning information encoded as an exception.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException), SAXParseException

fatalError

public void fatalError(SAXParseException e)
                throws SAXException
Report a fatal XML parsing error.

The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.

Specified by:
fatalError in interface ErrorHandler
Parameters:
e - The error information encoded as an exception.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException), SAXParseException

getErrorCount

public int getErrorCount()

getWarningCount

public int getWarningCount()

printSummary

public void printSummary()