| TemplateLaxErrorHandler.java |
1 /*
2 * TemplateLaxErrorHandler.java
3 *
4 * Copyright (c) 1998-2004, 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.7 2004/07/21 17:10:09 akshay Exp $
14 */
15
16 // modify this according with your package
17 package gate.util;
18
19 /**
20 * TemplateLaxErrorHandler
21 */
22 import java.io.File;
23
24 import org.xml.sax.SAXException;
25 import org.xml.sax.SAXParseException;
26
27 // this import is for the abstract class LaxErrorHandler located in gate.util
28
29
30 // modify the class name the way you want
31 public class TemplateLaxErrorHandler extends LaxErrorHandler {
32
33 /** Debug flag */
34 private static final boolean DEBUG = false;
35
36 /**
37 * TemplateLaxErrorHandler constructor comment.
38 */
39 public TemplateLaxErrorHandler() {super();}
40
41 /**
42 * error method comment.
43 */
44 public void error(SAXParseException ex) throws SAXException{
45 // do something with the error
46 File fInput = new File (ex.getSystemId());
47 Err.println("e: " + fInput.getPath() + ": line " +
48 ex.getLineNumber() + ": " + ex);
49 } // error
50
51 /**
52 * fatalError method comment.
53 */
54 public void fatalError(SAXParseException ex) throws SAXException{
55 // do something with the fatalError
56 File fInput = new File(ex.getSystemId());
57 Err.println("E: " + fInput.getName() + ": line " +
58 ex.getLineNumber() + ": " + ex);
59 } // fatalError
60
61 /**
62 * warning method comment.
63 */
64 public void warning(SAXParseException ex) throws SAXException {
65 // do something with the warning.
66 File fInput = new File(ex.getSystemId());
67 Err.println("w: " + fInput.getName() + ": line " +
68 ex.getLineNumber() + ": " + ex);
69 } // warning
70
71 } // TemplateLaxErrorHandler
72