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.LiteratureItemVo; |
21 |
| import org.qedeq.kernel.xml.parser.AbstractSimpleHandler; |
22 |
| import org.qedeq.kernel.xml.parser.SimpleAttributes; |
23 |
| import org.qedeq.kernel.xml.parser.SyntaxException; |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| public final class LiteratureItemHandler extends AbstractSimpleHandler { |
33 |
| |
34 |
| |
35 |
| public static final String ITEM_TAG = "ITEM"; |
36 |
| |
37 |
| |
38 |
| private final LatexListHandler itemHandler; |
39 |
| |
40 |
| |
41 |
| private LiteratureItemVo literatureItem; |
42 |
| |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
| |
49 |
| |
50 |
27
| public LiteratureItemHandler(final AbstractSimpleHandler handler) {
|
51 |
27
| super(handler, ITEM_TAG);
|
52 |
27
| itemHandler = new LatexListHandler(this, ITEM_TAG);
|
53 |
| } |
54 |
| |
55 |
27
| public final void init() {
|
56 |
27
| literatureItem = null;
|
57 |
| } |
58 |
| |
59 |
| |
60 |
| |
61 |
| |
62 |
| |
63 |
| |
64 |
27
| public final LiteratureItemVo getLiteratureItem() {
|
65 |
27
| return literatureItem;
|
66 |
| } |
67 |
| |
68 |
27
| public final void startElement(final String name, final SimpleAttributes attributes)
|
69 |
| throws SyntaxException { |
70 |
27
| if (getStartTag().equals(name)) {
|
71 |
27
| literatureItem = new LiteratureItemVo();
|
72 |
27
| literatureItem.setLabel(attributes.getString("label"));
|
73 |
27
| changeHandler(itemHandler, name, attributes);
|
74 |
| } else { |
75 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
76 |
| } |
77 |
| } |
78 |
| |
79 |
27
| public final void endElement(final String name) throws SyntaxException {
|
80 |
27
| if (getStartTag().equals(name)) {
|
81 |
27
| literatureItem.setItem(itemHandler.getLatexList());
|
82 |
| } else { |
83 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
84 |
| } |
85 |
| } |
86 |
| |
87 |
| |
88 |
| } |