public class CountingErrorHandler
extends java.lang.Object
implements org.xml.sax.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.
Modifier and Type | Field and Description |
---|---|
private static Debug |
_debug |
private int |
_errorCount |
private int |
_numberOfWarnings |
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() |
private static java.lang.String |
toString(org.xml.sax.SAXParseException e) |
void |
warning(org.xml.sax.SAXParseException e)
Receive notification of a parser warning.
|
private static final Debug _debug
private int _errorCount
private int _numberOfWarnings
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.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.
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
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.
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
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.
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
private static java.lang.String toString(org.xml.sax.SAXParseException e)
public int getErrorCount()
public int getWarningCount()
public void printSummary()