1 // This file is part of TagSoup and is Copyright 2002-2008 by John Cowan.
2 //
3 // TagSoup is licensed under the Apache License,
4 // Version 2.0.  You may obtain a copy of this license at
5 // http://www.apache.org/licenses/LICENSE-2.0 .  You may also have
6 // additional legal rights not granted by this license.
7 //
8 // TagSoup is distributed in the hope that it will be useful, but
9 // unless required by applicable law or agreed to in writing, TagSoup
10 // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
11 // OF ANY KIND, either express or implied; not even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 //
14 //
15 // Scanner handler
16 
17 package org.ccil.cowan.tagsoup;
18 import org.xml.sax.SAXException;
19 
20 /**
21 An interface that Scanners use to report events in the input stream.
22 **/
23 
24 public interface ScanHandler {
25 	/**
26 	Reports an attribute name without a value.
27 	**/
28 
adup(char[] buff, int offset, int length)29 	public void adup(char[] buff, int offset, int length) throws SAXException;
30 
31 	/**
32 	Reports an attribute name; a value will follow.
33 	**/
34 
aname(char[] buff, int offset, int length)35 	public void aname(char[] buff, int offset, int length) throws SAXException;
36 
37 	/**
38 	Reports an attribute value.
39 	**/
40 
aval(char[] buff, int offset, int length)41 	public void aval(char[] buff, int offset, int length) throws SAXException;
42 
43 	/**
44 	  * Reports the content of a CDATA section (not a CDATA element)
45 	  */
cdsect(char[] buff, int offset, int length)46 	public void cdsect(char[] buff, int offset, int length) throws SAXException;
47 
48 	/**
49          * Reports a <!....> declaration - typically a DOCTYPE
50          */
51 
decl(char[] buff, int offset, int length)52 	public void decl(char[] buff, int offset, int length) throws SAXException;
53 
54 	/**
55 	Reports an entity reference or character reference.
56 	**/
57 
entity(char[] buff, int offset, int length)58 	public void entity(char[] buff, int offset, int length) throws SAXException;
59 
60 	/**
61 	Reports EOF.
62 	**/
63 
eof(char[] buff, int offset, int length)64 	public void eof(char[] buff, int offset, int length) throws SAXException;
65 
66 	/**
67 	Reports an end-tag.
68 	**/
69 
etag(char[] buff, int offset, int length)70 	public void etag(char[] buff, int offset, int length) throws SAXException;
71 
72 	/**
73 	Reports the general identifier (element type name) of a start-tag.
74 	**/
75 
gi(char[] buff, int offset, int length)76 	public void gi(char[] buff, int offset, int length) throws SAXException;
77 
78 	/**
79 	Reports character content.
80 	**/
81 
pcdata(char[] buff, int offset, int length)82 	public void pcdata(char[] buff, int offset, int length) throws SAXException;
83 
84 	/**
85 	Reports the data part of a processing instruction.
86 	**/
87 
pi(char[] buff, int offset, int length)88 	public void pi(char[] buff, int offset, int length) throws SAXException;
89 
90 	/**
91 	Reports the target part of a processing instruction.
92 	**/
93 
pitarget(char[] buff, int offset, int length)94 	public void pitarget(char[] buff, int offset, int length) throws SAXException;
95 
96 	/**
97 	Reports the close of a start-tag.
98 	**/
99 
stagc(char[] buff, int offset, int length)100 	public void stagc(char[] buff, int offset, int length) throws SAXException;
101 
102 	/**
103 	Reports the close of an empty-tag.
104 	**/
105 
stage(char[] buff, int offset, int length)106 	public void stage(char[] buff, int offset, int length) throws SAXException;
107 
108 	/**
109 	Reports a comment.
110 	**/
111 
cmnt(char[] buff, int offset, int length)112 	public void cmnt(char[] buff, int offset, int length) throws SAXException;
113 
114 	/**
115 	Returns the value of the last entity or character reference reported.
116 	**/
117 
getEntity()118 	public int getEntity();
119 	}
120