1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.qedeq.kernel.xml.handler.module;
17
18 import org.qedeq.kernel.se.dto.module.SubsectionListVo;
19 import org.qedeq.kernel.xml.common.XmlSyntaxException;
20 import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
21 import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
22
23
24
25
26
27
28
29 public class SubsectionListHandler extends AbstractSimpleHandler {
30
31
32 private SubsectionListVo list;
33
34
35 private final SubsectionHandler subsectionHandler;
36
37
38 private final NodeHandler nodeHandler;
39
40
41
42
43
44
45
46 public SubsectionListHandler(final AbstractSimpleHandler handler) {
47 super(handler, "SUBSECTIONS");
48 subsectionHandler = new SubsectionHandler(this);
49 nodeHandler = new NodeHandler(this);
50 }
51
52 public final void init() {
53 list = new SubsectionListVo();
54 }
55
56
57
58
59
60
61 public final SubsectionListVo getSubsectionList() {
62 return list;
63 }
64
65 public final void startElement(final String name, final SimpleAttributes attributes)
66 throws XmlSyntaxException {
67 if (getStartTag().equals(name)) {
68
69 } else if (subsectionHandler.getStartTag().equals(name)) {
70 changeHandler(subsectionHandler, name, attributes);
71 } else if (nodeHandler.getStartTag().equals(name)) {
72 changeHandler(nodeHandler, name, attributes);
73 } else {
74 throw XmlSyntaxException.createUnexpectedTagException(name);
75 }
76 }
77
78 public final void endElement(final String name) throws XmlSyntaxException {
79 if (getStartTag().equals(name)) {
80
81 } else if (subsectionHandler.getStartTag().equals(name)) {
82 list.add(subsectionHandler.getSubsection());
83 } else if (nodeHandler.getStartTag().equals(name)) {
84 list.add(nodeHandler.getNode());
85 } else {
86 throw XmlSyntaxException.createUnexpectedTagException(name);
87 }
88 }
89 }