1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.quiotix.html.parser;
17
18 import java.util.Iterator;
19
20
21
22
23
24
25
26 public abstract class HtmlVisitor {
27
28 public void visit(HtmlDocument.Tag t) {
29 }
30
31
32 public void visit(HtmlDocument.EndTag t) {
33 }
34
35
36 public void visit(HtmlDocument.Comment c) {
37 }
38
39
40 public void visit(HtmlDocument.Text t) {
41 }
42
43
44 public void visit(HtmlDocument.Newline n) {
45 }
46
47
48 public void visit(HtmlDocument.Annotation a) {
49 }
50
51
52 public void visit(HtmlDocument.TagBlock bl) {
53 bl.startTag.accept(this);
54 visit(bl.body);
55 bl.endTag.accept(this);
56 }
57
58
59 public void visit(HtmlDocument.ElementSequence s) {
60 for (Iterator iterator = s.iterator(); iterator.hasNext();) {
61 HtmlDocument.HtmlElement htmlElement = (HtmlDocument.HtmlElement) iterator.next();
62 htmlElement.accept(this);
63 }
64 }
65
66
67 public void visit(HtmlDocument d) {
68 start();
69 visit(d.elements);
70 finish();
71 }
72
73
74
75 public void start() {
76 }
77
78
79 public void finish() {
80 }
81 }
82