Class CountingErrorHandler

java.lang.Object
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.
  • Constructor Details

    • CountingErrorHandler

      public CountingErrorHandler()
  • Method Details

    • 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:
    • 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:
    • 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:
    • getErrorCount

      public int getErrorCount()
    • getWarningCount

      public int getWarningCount()
    • printSummary

      public void printSummary()