01: package de.webman.util.xslt;
02:
03: import javax.xml.transform.ErrorListener;
04: import javax.xml.transform.TransformerException;
05: import org.apache.log4j.Category;
06:
07: /**
08: * Implementierung des JAXP Error Listeners.
09: *
10: * @author $Author: alex $
11: * @version $Revision: 1.2 $
12: */
13: public class XSLTErrorListener implements ErrorListener {
14:
15: // $Id: XSLTErrorListener.java,v 1.2 2001/11/06 12:25:40 alex Exp $
16:
17: // Constants.
18:
19: /**
20: * The warning message.
21: */
22: private static final String MESSAGE_WARNING = "Warning during XSL transformation: ";
23:
24: /**
25: * The error message.
26: */
27: private static final String MESSAGE_ERROR = "Recoverable error during XSL transformation: ";
28:
29: /**
30: * The fatal error message.
31: */
32: private static final String MESSAGE_FATAL_ERROR = "Non-recoverable error during XSL transformation: ";
33:
34: /**
35: * The logging category.
36: */
37: private static Category cat = Category
38: .getInstance(XSLTErrorListener.class);
39:
40: // Implementation of 'javax.xml.transform.ErrorListener'.
41:
42: /**
43: * Logs a warning.
44: *
45: * @param exception the warning information encapsulated in a
46: * transformer exception.
47: */
48: public void warning(TransformerException exception) {
49: cat.warn(MESSAGE_WARNING + exception.toString(), exception);
50: }
51:
52: /**
53: * Logs a recoverable error.
54: *
55: * @param exception the error information encapsulated in a
56: * transformer exception.
57: */
58: public void error(TransformerException exception) {
59: cat.error(MESSAGE_ERROR + exception.toString(), exception);
60: }
61:
62: /**
63: * Logs a non-recoverable error.
64: *
65: * @param exception the error information encapsulated in a
66: * transformer exception.
67: */
68: public void fatalError(TransformerException exception) {
69: cat
70: .error(MESSAGE_FATAL_ERROR + exception.toString(),
71: exception);
72: }
73:
74: }
|