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.ImportListVo;
19 import org.qedeq.kernel.se.dto.module.ImportVo;
20 import org.qedeq.kernel.xml.common.XmlSyntaxException;
21 import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
22 import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
23
24
25
26
27
28
29
30
31 public class ImportListHandler extends AbstractSimpleHandler {
32
33
34 private ImportListVo list;
35
36
37 private final SpecificationHandler specificationHandler;
38
39
40 private String label;
41
42
43
44
45
46
47
48 public ImportListHandler(final AbstractSimpleHandler handler) {
49 super(handler, "IMPORTS");
50 specificationHandler = new SpecificationHandler(this);
51 }
52
53 public final void init() {
54 list = null;
55 }
56
57
58
59
60
61
62 public final ImportListVo getImportList() {
63 return list;
64 }
65
66 public final void startElement(final String name, final SimpleAttributes attributes)
67 throws XmlSyntaxException {
68 if (getStartTag().equals(name)) {
69 list = new ImportListVo();
70 } else if ("IMPORT".equals(name)) {
71 label = attributes.getString("label");
72 } else if (specificationHandler.getStartTag().equals(name)) {
73 changeHandler(specificationHandler, name, attributes);
74 } else {
75 throw XmlSyntaxException.createUnexpectedTagException(name);
76 }
77 }
78
79 public final void endElement(final String name) throws XmlSyntaxException {
80 if (getStartTag().equals(name)) {
81
82 } else if (specificationHandler.getStartTag().equals(name)) {
83
84 } else if ("IMPORT".equals(name)) {
85 list.add(new ImportVo(label, specificationHandler.getSpecification()));
86 } else {
87 throw XmlSyntaxException.createUnexpectedTagException(name);
88 }
89 }
90 }