public class CountingErrorHandler
extends java.lang.Object
implements org.xml.sax.ErrorHandler
Constructor and Description |
---|
CountingErrorHandler() |
Modifier and Type | Method and Description |
---|---|
void |
error(org.xml.sax.SAXParseException e)
Receive notification of a recoverable parser error.
|
void |
fatalError(org.xml.sax.SAXParseException e)
Report a fatal XML parsing error.
|
int |
getErrorCount() |
int |
getWarningCount() |
void |
printSummary() |
void |
warning(org.xml.sax.SAXParseException e)
Receive notification of a parser warning.
|
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
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.
warning
in interface org.xml.sax.ErrorHandler
e
- The warning information encoded as an exception.org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.warning(org.xml.sax.SAXParseException)
,
SAXParseException
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
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.
error
in interface org.xml.sax.ErrorHandler
e
- The warning information encoded as an exception.org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.warning(org.xml.sax.SAXParseException)
,
SAXParseException
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
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.
fatalError
in interface org.xml.sax.ErrorHandler
e
- The error information encoded as an exception.org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.fatalError(org.xml.sax.SAXParseException)
,
SAXParseException
public int getErrorCount()
public int getWarningCount()
public void printSummary()