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.SubsectionListVo; |
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 |
| public final class SubsectionListHandler extends AbstractSimpleHandler { |
32 |
| |
33 |
| |
34 |
| private SubsectionListVo list; |
35 |
| |
36 |
| |
37 |
| private final SubsectionHandler subsectionHandler; |
38 |
| |
39 |
| |
40 |
| private final NodeHandler nodeHandler; |
41 |
| |
42 |
| |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
27
| public SubsectionListHandler(final AbstractSimpleHandler handler) {
|
49 |
27
| super(handler, "SUBSECTIONS");
|
50 |
27
| subsectionHandler = new SubsectionHandler(this);
|
51 |
27
| nodeHandler = new NodeHandler(this);
|
52 |
| } |
53 |
| |
54 |
70
| public final void init() {
|
55 |
70
| list = new SubsectionListVo();
|
56 |
| } |
57 |
| |
58 |
| |
59 |
| |
60 |
| |
61 |
| |
62 |
| |
63 |
70
| public final SubsectionListVo getSubsectionList() {
|
64 |
70
| return list;
|
65 |
| } |
66 |
| |
67 |
479
| public final void startElement(final String name, final SimpleAttributes attributes)
|
68 |
| throws SyntaxException { |
69 |
479
| if (getStartTag().equals(name)) {
|
70 |
| |
71 |
409
| } else if (subsectionHandler.getStartTag().equals(name)) {
|
72 |
61
| changeHandler(subsectionHandler, name, attributes);
|
73 |
348
| } else if (nodeHandler.getStartTag().equals(name)) {
|
74 |
348
| changeHandler(nodeHandler, name, attributes);
|
75 |
| } else { |
76 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
77 |
| } |
78 |
| } |
79 |
| |
80 |
479
| public final void endElement(final String name) throws SyntaxException {
|
81 |
479
| if (getStartTag().equals(name)) {
|
82 |
| |
83 |
409
| } else if (subsectionHandler.getStartTag().equals(name)) {
|
84 |
61
| list.add(subsectionHandler.getSubsection());
|
85 |
348
| } else if (nodeHandler.getStartTag().equals(name)) {
|
86 |
348
| list.add(nodeHandler.getNode());
|
87 |
| } else { |
88 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
89 |
| } |
90 |
| } |
91 |
| } |