Contents | Package | Class | Tree | Deprecated | Index | Help | XML for Java 1.0.4 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
An application may implement this interface in order to redirect and alter the presentation of XML4J parser errors and exceptions.
For example, the following code fragment listens for parser errors and suppresses any output:
class ErrorIgnorer implements ErrorListener { public void error(String fileName, int lineNo, int charOffset, Object key, String msg) { // Do nothing..in other words, suppress all notifications. } } public static void main(String[] argv) { ... InputStream is = new FileInputStream(fname); Parser p = new Parser(fname, new ErrorIgnorer(), null); // Suppress any parser errors TXDocument doc = p.readStream(is); ... }
Method Summary | |
void | error(java.lang.String fileName,
int lineNo,
int charOffset,
java.lang.Object key,
java.lang.String msg)
|
Method Detail |
public void error(java.lang.String fileName, int lineNo, int charOffset, java.lang.Object key, java.lang.String msg)
fileName
- Processing file name, or null if error or warning
occurs in a document.
lineNo
- The line number where the current document event ends, or
-1 if not available. Note that this is the line
position of the first character after the text associated with
the document event. Do NOT trust this value when the input
stream includes invalid octet as its encoding.
charOffset
- The column number where the current document event ends, or
-1 if not available. Note that this is the column
number of the first character after the text associated with the
document event. The first column in a line is position 1. Do NOT
trust this value when the input stream includes invalid octet as its encoding.
key
- The object may be an instance of String
or Exception
.
When this object is String
, this value may help
classify msg as an error (begins with "E_") or warning
(begins with "W_").
msg
- The error or warning message.
Contents | Package | Class | Tree | Deprecated | Index | Help | |||
PREV | NEXT | SHOW LISTS | HIDE LISTS |