1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.esigate.parser.future;
16
17 import java.io.IOException;
18 import java.util.concurrent.Future;
19
20 import org.esigate.HttpErrorPage;
21
22
23
24
25
26
27 public class UnknownElement implements FutureElement {
28
29
30
31 public static final FutureElementType TYPE = new FutureElementType() {
32
33 private final UnknownElement instance = new UnknownElement();
34
35 @Override
36 public boolean isStartTag(String tag) {
37 return true;
38 }
39
40 @Override
41 public boolean isEndTag(String tag) {
42 return false;
43 }
44
45 @Override
46 public FutureElement newInstance() {
47 return instance;
48 }
49
50 @Override
51 public boolean isSelfClosing(String tag) {
52 return true;
53 }
54 };
55
56 @Override
57 public boolean onTagStart(String tag, FutureParserContext ctx) throws IOException, HttpErrorPage {
58
59 ctx.characters(new CharSequenceFuture(tag));
60 return true;
61 }
62
63 @Override
64 public void onTagEnd(String tag, FutureParserContext ctx) throws IOException, HttpErrorPage {
65
66 }
67
68 @Override
69 public boolean onError(Exception e, FutureParserContext ctx) {
70 return false;
71 }
72
73 @Override
74 public void characters(Future<CharSequence> csq) throws IOException {
75 throw new UnsupportedOperationException("characters are appended in onTagStart method");
76 }
77
78 @Override
79 public FutureElement getParent() {
80 return null;
81 }
82 }