XmlErrorHandler (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.tomcat.util.descriptor, class: XmlErrorHandler

# Class XmlErrorHandler

java.lang.Object
org.apache.tomcat.util.descriptor.XmlErrorHandler

All Implemented Interfaces:
  `ErrorHandler`

public class XmlErrorHandler extends Object implements ErrorHandler
SAX error handler that collects warnings and errors for later processing.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `XmlErrorHandler()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `error(SAXParseException exception)`
  `void`
  `fatalError(SAXParseException exception)`
  `List<SAXParseException>`
  `getErrors()`
  Returns the list of collected parsing errors.
  `List<SAXParseException>`
  `getWarnings()`
  Returns the list of collected parsing warnings.
  `void`
  `logFindings(Log log, String source)`
  Logs all collected warnings and errors to the specified log.
  `void`
  `warning(SAXParseException exception)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### XmlErrorHandler

    public XmlErrorHandler()
    Default constructor.

- ## Method Details

  - ### error

    public void error(SAXParseException exception) throws SAXException
    Specified by:
      `error` in interface `ErrorHandler`
    Throws:
      `SAXException`

  - ### fatalError

    public void fatalError(SAXParseException exception) throws SAXException
    Specified by:
      `fatalError` in interface `ErrorHandler`
    Throws:
      `SAXException`

  - ### warning

    public void warning(SAXParseException exception) throws SAXException
    Specified by:
      `warning` in interface `ErrorHandler`
    Throws:
      `SAXException`

  - ### getErrors

    public List<SAXParseException> getErrors()
    Returns the list of collected parsing errors.
    Returns:
      the list of errors

  - ### getWarnings

    public List<SAXParseException> getWarnings()
    Returns the list of collected parsing warnings.
    Returns:
      the list of warnings

  - ### logFindings

    public void logFindings(Log log, String source)
    Logs all collected warnings and errors to the specified log.
    Parameters:
      `log` - the log to use
      `source` - the source of the XML being parsed