Class CountingErrorHandler
- All Implemented Interfaces:
org.xml.sax.ErrorHandler
public class CountingErrorHandler
extends java.lang.Object
implements org.xml.sax.ErrorHandler
-
Constructor Summary
Constructors Constructor Description CountingErrorHandler() -
Method Summary
Modifier and Type Method Description voiderror(org.xml.sax.SAXParseException e)Receive notification of a recoverable parser error.voidfatalError(org.xml.sax.SAXParseException e)Report a fatal XML parsing error.intgetErrorCount()intgetWarningCount()voidprintSummary()voidwarning(org.xml.sax.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 Details
-
CountingErrorHandler
public CountingErrorHandler()
-
-
Method Details
-
warning
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXExceptionReceive 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:
warningin interfaceorg.xml.sax.ErrorHandler- Parameters:
e- The warning information encoded as an exception.- Throws:
org.xml.sax.SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
SAXParseException
-
error
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXExceptionReceive 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:
errorin interfaceorg.xml.sax.ErrorHandler- Parameters:
e- The warning information encoded as an exception.- Throws:
org.xml.sax.SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException),SAXParseException
-
fatalError
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXExceptionReport 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:
fatalErrorin interfaceorg.xml.sax.ErrorHandler- Parameters:
e- The error information encoded as an exception.- Throws:
org.xml.sax.SAXException- Any SAX exception, possibly wrapping another exception.- See Also:
SAXParseException
-
getErrorCount
public int getErrorCount() -
getWarningCount
public int getWarningCount() -
printSummary
public void printSummary()
-