|
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.HeaderVo; |
|
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 HeaderHandler extends AbstractSimpleHandler { |
|
33 |
| |
|
34 |
| |
|
35 |
| private HeaderVo header; |
|
36 |
| |
|
37 |
| |
|
38 |
| private final SpecificationHandler specificationHandler; |
|
39 |
| |
|
40 |
| |
|
41 |
| private final LatexListHandler titleHandler; |
|
42 |
| |
|
43 |
| |
|
44 |
| private final LatexListHandler abstractHandler; |
|
45 |
| |
|
46 |
| |
|
47 |
| private final AuthorListHandler authorListHandler; |
|
48 |
| |
|
49 |
| |
|
50 |
| private final ImportListHandler importListHandler; |
|
51 |
| |
|
52 |
| |
|
53 |
| private final UsedByListHandler usedbyListHandler; |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
27
| public HeaderHandler(final AbstractSimpleHandler handler) {
|
|
62 |
27
| super(handler, "HEADER");
|
|
63 |
27
| titleHandler = new LatexListHandler(this, "TITLE");
|
|
64 |
27
| abstractHandler = new LatexListHandler(this, "ABSTRACT");
|
|
65 |
27
| specificationHandler = new SpecificationHandler(this);
|
|
66 |
27
| authorListHandler = new AuthorListHandler(this);
|
|
67 |
27
| importListHandler = new ImportListHandler(this);
|
|
68 |
27
| usedbyListHandler = new UsedByListHandler(this);
|
|
69 |
| } |
|
70 |
| |
|
71 |
26
| public final void init() {
|
|
72 |
26
| header = null;
|
|
73 |
| } |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
26
| public final HeaderVo getHeader() {
|
|
81 |
26
| return header;
|
|
82 |
| } |
|
83 |
| |
|
84 |
163
| public final void startElement(final String name, final SimpleAttributes attributes)
|
|
85 |
| throws SyntaxException { |
|
86 |
163
| if (getStartTag().equals(name)) {
|
|
87 |
26
| header = new HeaderVo();
|
|
88 |
26
| header.setEmail(attributes.getString("email"));
|
|
89 |
137
| } else if (specificationHandler.getStartTag().equals(name)) {
|
|
90 |
26
| changeHandler(specificationHandler, name, attributes);
|
|
91 |
111
| } else if (titleHandler.getStartTag().equals(name)) {
|
|
92 |
26
| changeHandler(titleHandler, name, attributes);
|
|
93 |
85
| } else if (abstractHandler.getStartTag().equals(name)) {
|
|
94 |
26
| changeHandler(abstractHandler, name, attributes);
|
|
95 |
59
| } else if (authorListHandler.getStartTag().equals(name)) {
|
|
96 |
26
| changeHandler(authorListHandler, name, attributes);
|
|
97 |
33
| } else if (importListHandler.getStartTag().equals(name)) {
|
|
98 |
18
| changeHandler(importListHandler, name, attributes);
|
|
99 |
15
| } else if (usedbyListHandler.getStartTag().equals(name)) {
|
|
100 |
15
| changeHandler(usedbyListHandler, name, attributes);
|
|
101 |
| } else { |
|
102 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
|
103 |
| } |
|
104 |
| } |
|
105 |
| |
|
106 |
163
| public final void endElement(final String name) throws SyntaxException {
|
|
107 |
163
| if (getStartTag().equals(name)) {
|
|
108 |
| |
|
109 |
137
| } else if (specificationHandler.getStartTag().equals(name)) {
|
|
110 |
26
| header.setSpecification(specificationHandler.getSpecification());
|
|
111 |
111
| } else if (titleHandler.getStartTag().equals(name)) {
|
|
112 |
26
| header.setTitle(titleHandler.getLatexList());
|
|
113 |
85
| } else if (abstractHandler.getStartTag().equals(name)) {
|
|
114 |
26
| header.setSummary(abstractHandler.getLatexList());
|
|
115 |
59
| } else if (authorListHandler.getStartTag().equals(name)) {
|
|
116 |
26
| header.setAuthorList(authorListHandler.getAuthorList());
|
|
117 |
33
| } else if (importListHandler.getStartTag().equals(name)) {
|
|
118 |
18
| header.setImportList(importListHandler.getImportList());
|
|
119 |
15
| } else if (usedbyListHandler.getStartTag().equals(name)) {
|
|
120 |
15
| header.setUsedByList(usedbyListHandler.getUsedByList());
|
|
121 |
| } else { |
|
122 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
|
123 |
| } |
|
124 |
| } |
|
125 |
| |
|
126 |
| } |