|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| package org.qedeq.kernel.xml.parser; |
|
19 |
| |
|
20 |
| import java.net.URL; |
|
21 |
| |
|
22 |
| import org.qedeq.kernel.common.DefaultSourceFileExceptionList; |
|
23 |
| import org.qedeq.kernel.common.SourceArea; |
|
24 |
| import org.qedeq.kernel.common.SourceFileException; |
|
25 |
| import org.qedeq.kernel.common.SourcePosition; |
|
26 |
| import org.qedeq.kernel.trace.Trace; |
|
27 |
| import org.xml.sax.ErrorHandler; |
|
28 |
| import org.xml.sax.SAXException; |
|
29 |
| import org.xml.sax.SAXParseException; |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| public class SaxErrorHandler implements ErrorHandler { |
|
39 |
| |
|
40 |
| |
|
41 |
| private static final Class CLASS = SaxErrorHandler.class; |
|
42 |
| |
|
43 |
| |
|
44 |
| public static final int SAX_PARSER_EXCEPTION = 9001; |
|
45 |
| |
|
46 |
| |
|
47 |
| private final URL url; |
|
48 |
| |
|
49 |
| |
|
50 |
| private final DefaultSourceFileExceptionList list; |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
671
| public SaxErrorHandler(final URL url, final DefaultSourceFileExceptionList list) {
|
|
59 |
671
| super();
|
|
60 |
671
| Trace.param(CLASS, this, "SaxErrorHandler", "url", url);
|
|
61 |
671
| this.url = url;
|
|
62 |
671
| this.list = list;
|
|
63 |
| } |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
0
| public final void warning(final SAXParseException e) throws SAXException {
|
|
69 |
0
| final SourceFileException sf = new SourceFileException(SAX_PARSER_EXCEPTION, e.getMessage(),
|
|
70 |
| e, new SourceArea(url, new SourcePosition(url, e.getLineNumber(), |
|
71 |
| e.getColumnNumber()), null), null); |
|
72 |
0
| Trace.trace(CLASS, this, "warning", e);
|
|
73 |
0
| Trace.trace(CLASS, this, "warning", sf);
|
|
74 |
0
| list.add(sf);
|
|
75 |
| } |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
45
| public final void error(final SAXParseException e) throws SAXException {
|
|
81 |
45
| final SourceFileException sf = new SourceFileException(SAX_PARSER_EXCEPTION, e.getMessage(),
|
|
82 |
| e, new SourceArea(url, new SourcePosition(url, e.getLineNumber(), |
|
83 |
| e.getColumnNumber()), null), null); |
|
84 |
45
| Trace.trace(CLASS, this, "error", e);
|
|
85 |
45
| Trace.trace(CLASS, this, "error", sf);
|
|
86 |
45
| list.add(sf);
|
|
87 |
| } |
|
88 |
| |
|
89 |
| |
|
90 |
| |
|
91 |
| |
|
92 |
5
| public final void fatalError(final SAXParseException e) throws SAXException {
|
|
93 |
5
| final SourceFileException sf = new SourceFileException(SAX_PARSER_EXCEPTION, e.getMessage(),
|
|
94 |
| e, new SourceArea(url, new SourcePosition(url, e.getLineNumber(), |
|
95 |
| e.getColumnNumber()), null), null); |
|
96 |
5
| Trace.trace(CLASS, this, "fatalError", e);
|
|
97 |
5
| Trace.trace(CLASS, this, "fatalError", sf);
|
|
98 |
5
| list.add(sf);
|
|
99 |
| } |
|
100 |
| |
|
101 |
| } |