Contents | Package | Class | Tree | Deprecated | Index | Help XML for Java 1.0.4
PREV | NEXT SHOW LISTS | HIDE LISTS

Interface com.ibm.xml.parser.ErrorListener

Implementing Classes:
SAXDriver, Stderr

public interface ErrorListener
An interface for handling error and warning events that are recognized by the XML4J parser.

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);
     ...
   }

 

Version:
Revision: 01 1.3 src/com/ibm/xml/parser/ErrorListener.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4

Method Summary
void  error(java.lang.String fileName, int lineNo, int charOffset, java.lang.Object key, java.lang.String msg)
Interface to be implemented in order to receive control when error and warning events are recognized by the parser.
 

Method Detail

error

public void error(java.lang.String fileName,
                  int lineNo,
                  int charOffset,
                  java.lang.Object key,
                  java.lang.String msg)
Interface to be implemented in order to receive control when error and warning events are recognized by the parser. Control is transferred prior to calling any ErrorHandlers.
Parameters:
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.
See Also:
error

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS