| TemplateLaxErrorHandler |

    1   /*
    2    *  TemplateLaxErrorHandler.java
    3    *
    4    *  Copyright (c) 1998-2001, The University of Sheffield.
    5    *
    6    *  This file is part of GATE (see http://gate.ac.uk/), and is free
    7    *  software, licenced under the GNU Library General Public License,
    8    *  Version 2, June 1991 (in the distribution as file licence.html,
    9    *  and also available at http://gate.ac.uk/gate/licence.html).
    10   *
    11   *  Cristian URSU, 07/July/2000
    12   *
    13   *  $Id: TemplateLaxErrorHandler.java,v 1.5 2000/11/08 16:35:11 hamish Exp $
    14   */
    15
    16  // modify this according with your package
    17  package gate.util;
    18
    19  /**
    20   * TemplateLaxErrorHandler
    21   */
    22  import java.io.*;
    23  import org.xml.sax.*;
    24
    25  // this import is for the abstract class LaxErrorHandler located in gate.util
    26
    27
    28  // modify the class name the way you want
    29  public class TemplateLaxErrorHandler extends LaxErrorHandler {
    30
    31    /** Debug flag */
    32    private static final boolean DEBUG = false;
    33
    34    /**
    35      * TemplateLaxErrorHandler constructor comment.
    36      */
    37    public TemplateLaxErrorHandler() {super();}
    38
    39    /**
    40      * error method comment.
    41      */
    42    public void error(SAXParseException ex) throws SAXException{
    43      // do something with the error
    44      File fInput = new File (ex.getSystemId());
    45      Err.println("e: " + fInput.getPath() + ": line " +
    46        ex.getLineNumber() + ": " + ex);
    47    } // error
    48
    49    /**
    50      * fatalError method comment.
    51      */
    52    public void fatalError(SAXParseException ex) throws SAXException{
    53      // do something with the fatalError
    54      File fInput = new File(ex.getSystemId());
    55      Err.println("E: " + fInput.getName() + ": line " +
    56        ex.getLineNumber() + ": " + ex);
    57    } // fatalError
    58
    59    /**
    60      * warning method comment.
    61      */
    62    public void warning(SAXParseException ex) throws SAXException {
    63      // do something with the warning.
    64      File fInput = new File(ex.getSystemId());
    65      Err.println("w: " + fInput.getName() + ": line " +
    66        ex.getLineNumber() + ": " + ex);
    67    } // warning
    68
    69  } // TemplateLaxErrorHandler
    70

| TemplateLaxErrorHandler |