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