|
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.AuthorListVo; |
|
22 |
| import org.qedeq.kernel.xml.parser.AbstractSimpleHandler; |
|
23 |
| import org.qedeq.kernel.xml.parser.SimpleAttributes; |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| public class AuthorListHandler extends AbstractSimpleHandler { |
|
32 |
| |
|
33 |
| |
|
34 |
| private AuthorListVo list; |
|
35 |
| |
|
36 |
| |
|
37 |
| private final AuthorHandler authorHandler; |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
46
| public AuthorListHandler(final AbstractSimpleHandler handler) {
|
|
46 |
46
| super(handler, "AUTHORS");
|
|
47 |
46
| authorHandler = new AuthorHandler(this);
|
|
48 |
| } |
|
49 |
| |
|
50 |
41
| public final void init() {
|
|
51 |
41
| list = new AuthorListVo();
|
|
52 |
| } |
|
53 |
| |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
41
| public final AuthorListVo getAuthorList() {
|
|
60 |
41
| return list;
|
|
61 |
| } |
|
62 |
| |
|
63 |
82
| public final void startElement(final String name, final SimpleAttributes attributes)
|
|
64 |
| throws SyntaxException { |
|
65 |
82
| if (getStartTag().equals(name)) {
|
|
66 |
| |
|
67 |
41
| } else if (authorHandler.getStartTag().equals(name)) {
|
|
68 |
41
| changeHandler(authorHandler, name, attributes);
|
|
69 |
| } else { |
|
70 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
|
71 |
| } |
|
72 |
| } |
|
73 |
| |
|
74 |
82
| public final void endElement(final String name) throws SyntaxException {
|
|
75 |
82
| if (getStartTag().equals(name)) {
|
|
76 |
| |
|
77 |
41
| } else if (authorHandler.getStartTag().equals(name)) {
|
|
78 |
41
| list.add(authorHandler.getAuthor());
|
|
79 |
| } else { |
|
80 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
|
81 |
| } |
|
82 |
| } |
|
83 |
| } |