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