1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.esigate.esi;
16
17 import java.io.IOException;
18
19 import org.esigate.HttpErrorPage;
20 import org.esigate.parser.Element;
21 import org.esigate.parser.ParserContext;
22
23 abstract class BaseElement implements Element {
24 private Element parent = null;
25
26 protected BaseElement() {
27 }
28
29
30 protected boolean parseTag(Tag tag, ParserContext ctx) throws HttpErrorPage {
31
32 return true;
33 }
34
35 @Override
36 public boolean onTagStart(String tag, ParserContext ctx) throws IOException, HttpErrorPage {
37 Tag tagObj = Tag.create(tag);
38 parent = ctx.getCurrent();
39 return parseTag(tagObj, ctx);
40 }
41
42 @Override
43 public boolean onError(Exception e, ParserContext ctx) {
44 return false;
45 }
46
47
48
49
50
51
52 @Override
53 public void characters(CharSequence csq, int start, int end) throws IOException {
54 parent.characters(csq, start, end);
55 }
56
57 }