Class DefaultErrorHandler

  • All Implemented Interfaces:
    ErrorHandler

    public class DefaultErrorHandler
    extends Object
    implements ErrorHandler
    Default SAX2 / DOM ErrorHandler class. Stores errors in a string List.

    This ErrorHandler is used by default in both (SAX & DOM) parsers. They have a method to extract the error Iterator from this handler. When the parser failed, you get the error Iterator from the parser and process all error messages in this Iterator.

    It is not possible to supply your own error handler, that's why this class is not public. You have to do post-mortem error processing as discussed above.

    Since:
    5.0
    Author:
    IdJ
    • Constructor Detail

      • DefaultErrorHandler

        public DefaultErrorHandler()
    • Method Detail

      • allOk

        public boolean allOk()
        test if the parsing went ok.
        Returns:
        boolean indicating if the parsing went ok.
      • getErrors

        public String[] getErrors()
        gets the list of parse errors.
        Returns:
        array of errors, may be empty, but never null.
      • clear

        public void clear()
        Clears the errors.
      • warning

        public void warning​(SAXParseException ex)
        SAX2 Warning handler - called while parsing.
        Specified by:
        warning in interface ErrorHandler
        Parameters:
        ex - The exception that occurred while parsing.
      • error

        public void error​(SAXParseException ex)
        SAX2 Error handler - called while parsing.
        Specified by:
        error in interface ErrorHandler
        Parameters:
        ex - The exception that occurred while parsing.
      • fatalError

        public void fatalError​(SAXParseException ex)
        SAX2 Fatal error handler - called while parsing.
        Specified by:
        fatalError in interface ErrorHandler
        Parameters:
        ex - The exception that occurred while parsing.