1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| package org.qedeq.kernel.xml.handler.module; |
19 |
| |
20 |
| import org.qedeq.kernel.dto.module.LatexListVo; |
21 |
| import org.qedeq.kernel.dto.module.LatexVo; |
22 |
| import org.qedeq.kernel.xml.parser.AbstractSimpleHandler; |
23 |
| import org.qedeq.kernel.xml.parser.SimpleAttributes; |
24 |
| import org.qedeq.kernel.xml.parser.SyntaxException; |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| public final class LatexListHandler extends AbstractSimpleHandler { |
33 |
| |
34 |
| |
35 |
| private String language; |
36 |
| |
37 |
| |
38 |
| private LatexListVo list; |
39 |
| |
40 |
| |
41 |
| private String data; |
42 |
| |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
| |
49 |
540
| public LatexListHandler(final AbstractSimpleHandler handler, final String startTag) {
|
50 |
540
| super(handler, startTag);
|
51 |
| } |
52 |
| |
53 |
1455
| public final void init() {
|
54 |
1455
| list = new LatexListVo();
|
55 |
| } |
56 |
| |
57 |
| |
58 |
| |
59 |
| |
60 |
| |
61 |
| |
62 |
1455
| public final LatexListVo getLatexList() {
|
63 |
1455
| return list;
|
64 |
| } |
65 |
| |
66 |
4054
| public final void startElement(final String name, final SimpleAttributes attributes)
|
67 |
| throws SyntaxException { |
68 |
4054
| if (getStartTag().equals(name)) {
|
69 |
| |
70 |
2599
| } else if ("LATEX".equals(name)) {
|
71 |
2599
| this.data = null;
|
72 |
2599
| language = attributes.getString("language");
|
73 |
| } else { |
74 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
75 |
| } |
76 |
| } |
77 |
| |
78 |
4054
| public final void endElement(final String name) throws SyntaxException {
|
79 |
4054
| if (getStartTag().equals(name)) {
|
80 |
| |
81 |
2599
| } else if ("LATEX".equals(name)) {
|
82 |
2599
| list.add(new LatexVo(language, data));
|
83 |
| } else { |
84 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
85 |
| } |
86 |
| } |
87 |
| |
88 |
2581
| public final void characters(final String name, final String data) {
|
89 |
2581
| if ("LATEX".equals(name)) {
|
90 |
2581
| this.data = data;
|
91 |
| } else { |
92 |
0
| throw new RuntimeException("Unexpected character data in tag: " + name);
|
93 |
| } |
94 |
| } |
95 |
| |
96 |
| } |