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
17package org.ccil.cowan.tagsoup;
18import org.xml.sax.SAXException;
19
20/**
21An interface that Scanners use to report events in the input stream.
22**/
23
24public interface ScanHandler {
25	/**
26	Reports an attribute name without a value.
27	**/
28
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
35	public void aname(char[] buff, int offset, int length) throws SAXException;
36
37	/**
38	Reports an attribute value.
39	**/
40
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	  */
46	public void cdsect(char[] buff, int offset, int length) throws SAXException;
47
48	/**
49         * Reports a <!....> declaration - typically a DOCTYPE
50         */
51
52	public void decl(char[] buff, int offset, int length) throws SAXException;
53
54	/**
55	Reports an entity reference or character reference.
56	**/
57
58	public void entity(char[] buff, int offset, int length) throws SAXException;
59
60	/**
61	Reports EOF.
62	**/
63
64	public void eof(char[] buff, int offset, int length) throws SAXException;
65
66	/**
67	Reports an end-tag.
68	**/
69
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
76	public void gi(char[] buff, int offset, int length) throws SAXException;
77
78	/**
79	Reports character content.
80	**/
81
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
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
94	public void pitarget(char[] buff, int offset, int length) throws SAXException;
95
96	/**
97	Reports the close of a start-tag.
98	**/
99
100	public void stagc(char[] buff, int offset, int length) throws SAXException;
101
102	/**
103	Reports the close of an empty-tag.
104	**/
105
106	public void stage(char[] buff, int offset, int length) throws SAXException;
107
108	/**
109	Reports a comment.
110	**/
111
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
118	public int getEntity();
119	}
120