1 /*
2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
78 * is probably not sufficient for use with a search engine.</p>
79 *
80 * <p>Note that the locator will return correct information only
81 * during the invocation of the events in this interface. The
82 * application should not attempt to use it at any other time.</p>
83 *
84 * @param locator An object that can return the location of
85 * any SAX document event.
86 * @see org.xml.sax.Locator
87 */
88 public abstract void setDocumentLocator (Locator locator);
89
90
91 /**
92 * Receive notification of the beginning of a document.
93 *
94 * <p>The SAX parser will invoke this method only once, before any
95 * other methods in this interface or in DTDHandler (except for
96 * setDocumentLocator).</p>
97 *
98 * @exception org.xml.sax.SAXException Any SAX exception, possibly
99 * wrapping another exception.
100 */
101 public abstract void startDocument ()
102 throws SAXException;
103
104
105 /**
106 * Receive notification of the end of a document.
107 *
108 * <p>The SAX parser will invoke this method only once, and it will
109 * be the last method invoked during the parse. The parser shall
110 * not invoke this method until it has either abandoned parsing
111 * (because of an unrecoverable error) or reached the end of
112 * input.</p>
113 *
114 * @exception org.xml.sax.SAXException Any SAX exception, possibly
115 * wrapping another exception.
116 */
117 public abstract void endDocument ()
118 throws SAXException;
119
120
121 /**
122 * Receive notification of the beginning of an element.
123 *
124 * <p>The Parser will invoke this method at the beginning of every
125 * element in the XML document; there will be a corresponding
126 * endElement() event for every startElement() event (even when the
127 * element is empty). All of the element's content will be
128 * reported, in order, before the corresponding endElement()
129 * event.</p>
130 *
131 * <p>If the element name has a namespace prefix, the prefix will
132 * still be attached. Note that the attribute list provided will
133 * contain only attributes with explicit values (specified or
134 * defaulted): #IMPLIED attributes will be omitted.</p>
135 *
136 * @param name The element type name.
137 * @param atts The attributes attached to the element, if any.
138 * @exception org.xml.sax.SAXException Any SAX exception, possibly
139 * wrapping another exception.
140 * @see #endElement
141 * @see org.xml.sax.AttributeList
142 */
143 public abstract void startElement (String name, AttributeList atts)
144 throws SAXException;
145
146
147 /**
148 * Receive notification of the end of an element.
149 *
150 * <p>The SAX parser will invoke this method at the end of every
151 * element in the XML document; there will be a corresponding
152 * startElement() event for every endElement() event (even when the
153 * element is empty).</p>
154 *
155 * <p>If the element name has a namespace prefix, the prefix will
156 * still be attached to the name.</p>
157 *
158 * @param name The element type name
159 * @exception org.xml.sax.SAXException Any SAX exception, possibly
160 * wrapping another exception.
161 */
162 public abstract void endElement (String name)
163 throws SAXException;
164
165
166 /**
167 * Receive notification of character data.
168 *
169 * <p>The Parser will call this method to report each chunk of
170 * character data. SAX parsers may return all contiguous character
171 * data in a single chunk, or they may split it into several
172 * chunks; however, all of the characters in any single event
173 * must come from the same external entity, so that the Locator
174 * provides useful information.</p>
175 *
176 * <p>The application must not attempt to read from the array
177 * outside of the specified range.</p>
178 *
179 * <p>Note that some parsers will report whitespace using the
180 * ignorableWhitespace() method rather than this one (validating
181 * parsers must do so).</p>
182 *
183 * @param ch The characters from the XML document.
184 * @param start The start position in the array.
185 * @param length The number of characters to read from the array.
186 * @exception org.xml.sax.SAXException Any SAX exception, possibly
187 * wrapping another exception.
188 * @see #ignorableWhitespace
189 * @see org.xml.sax.Locator
190 */
191 public abstract void characters (char ch[], int start, int length)
192 throws SAXException;
193
194
195 /**
196 * Receive notification of ignorable whitespace in element content.
197 *
198 * <p>Validating Parsers must use this method to report each chunk
199 * of ignorable whitespace (see the W3C XML 1.0 recommendation,
200 * section 2.10): non-validating parsers may also use this method
201 * if they are capable of parsing and using content models.</p>
202 *
203 * <p>SAX parsers may return all contiguous whitespace in a single
204 * chunk, or they may split it into several chunks; however, all of
205 * the characters in any single event must come from the same
206 * external entity, so that the Locator provides useful
207 * information.</p>
208 *
209 * <p>The application must not attempt to read from the array
210 * outside of the specified range.</p>
211 *
212 * @param ch The characters from the XML document.
213 * @param start The start position in the array.
214 * @param length The number of characters to read from the array.
215 * @exception org.xml.sax.SAXException Any SAX exception, possibly
216 * wrapping another exception.
217 * @see #characters
218 */
219 public abstract void ignorableWhitespace (char ch[], int start, int length)
220 throws SAXException;
221
222
223 /**
224 * Receive notification of a processing instruction.
225 *
226 * <p>The Parser will invoke this method once for each processing
227 * instruction found: note that processing instructions may occur
228 * before or after the main document element.</p>
229 *
230 * <p>A SAX parser should never report an XML declaration (XML 1.0,
231 * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
232 * using this method.</p>
233 *
234 * @param target The processing instruction target.
235 * @param data The processing instruction data, or null if
236 * none was supplied.
237 * @exception org.xml.sax.SAXException Any SAX exception, possibly
238 * wrapping another exception.
239 */
240 public abstract void processingInstruction (String target, String data)
241 throws SAXException;
242
243 }
244
245 // end of DocumentHandler.java
|
1 /*
2 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
78 * is probably not sufficient for use with a search engine.</p>
79 *
80 * <p>Note that the locator will return correct information only
81 * during the invocation of the events in this interface. The
82 * application should not attempt to use it at any other time.</p>
83 *
84 * @param locator An object that can return the location of
85 * any SAX document event.
86 * @see org.xml.sax.Locator
87 */
88 public abstract void setDocumentLocator (Locator locator);
89
90
91 /**
92 * Receive notification of the beginning of a document.
93 *
94 * <p>The SAX parser will invoke this method only once, before any
95 * other methods in this interface or in DTDHandler (except for
96 * setDocumentLocator).</p>
97 *
98 * @throws org.xml.sax.SAXException Any SAX exception, possibly
99 * wrapping another exception.
100 */
101 public abstract void startDocument ()
102 throws SAXException;
103
104
105 /**
106 * Receive notification of the end of a document.
107 *
108 * <p>The SAX parser will invoke this method only once, and it will
109 * be the last method invoked during the parse. The parser shall
110 * not invoke this method until it has either abandoned parsing
111 * (because of an unrecoverable error) or reached the end of
112 * input.</p>
113 *
114 * @throws org.xml.sax.SAXException Any SAX exception, possibly
115 * wrapping another exception.
116 */
117 public abstract void endDocument ()
118 throws SAXException;
119
120
121 /**
122 * Receive notification of the beginning of an element.
123 *
124 * <p>The Parser will invoke this method at the beginning of every
125 * element in the XML document; there will be a corresponding
126 * endElement() event for every startElement() event (even when the
127 * element is empty). All of the element's content will be
128 * reported, in order, before the corresponding endElement()
129 * event.</p>
130 *
131 * <p>If the element name has a namespace prefix, the prefix will
132 * still be attached. Note that the attribute list provided will
133 * contain only attributes with explicit values (specified or
134 * defaulted): #IMPLIED attributes will be omitted.</p>
135 *
136 * @param name The element type name.
137 * @param atts The attributes attached to the element, if any.
138 * @throws org.xml.sax.SAXException Any SAX exception, possibly
139 * wrapping another exception.
140 * @see #endElement
141 * @see org.xml.sax.AttributeList
142 */
143 public abstract void startElement (String name, AttributeList atts)
144 throws SAXException;
145
146
147 /**
148 * Receive notification of the end of an element.
149 *
150 * <p>The SAX parser will invoke this method at the end of every
151 * element in the XML document; there will be a corresponding
152 * startElement() event for every endElement() event (even when the
153 * element is empty).</p>
154 *
155 * <p>If the element name has a namespace prefix, the prefix will
156 * still be attached to the name.</p>
157 *
158 * @param name The element type name
159 * @throws org.xml.sax.SAXException Any SAX exception, possibly
160 * wrapping another exception.
161 */
162 public abstract void endElement (String name)
163 throws SAXException;
164
165
166 /**
167 * Receive notification of character data.
168 *
169 * <p>The Parser will call this method to report each chunk of
170 * character data. SAX parsers may return all contiguous character
171 * data in a single chunk, or they may split it into several
172 * chunks; however, all of the characters in any single event
173 * must come from the same external entity, so that the Locator
174 * provides useful information.</p>
175 *
176 * <p>The application must not attempt to read from the array
177 * outside of the specified range.</p>
178 *
179 * <p>Note that some parsers will report whitespace using the
180 * ignorableWhitespace() method rather than this one (validating
181 * parsers must do so).</p>
182 *
183 * @param ch The characters from the XML document.
184 * @param start The start position in the array.
185 * @param length The number of characters to read from the array.
186 * @throws org.xml.sax.SAXException Any SAX exception, possibly
187 * wrapping another exception.
188 * @see #ignorableWhitespace
189 * @see org.xml.sax.Locator
190 */
191 public abstract void characters (char ch[], int start, int length)
192 throws SAXException;
193
194
195 /**
196 * Receive notification of ignorable whitespace in element content.
197 *
198 * <p>Validating Parsers must use this method to report each chunk
199 * of ignorable whitespace (see the W3C XML 1.0 recommendation,
200 * section 2.10): non-validating parsers may also use this method
201 * if they are capable of parsing and using content models.</p>
202 *
203 * <p>SAX parsers may return all contiguous whitespace in a single
204 * chunk, or they may split it into several chunks; however, all of
205 * the characters in any single event must come from the same
206 * external entity, so that the Locator provides useful
207 * information.</p>
208 *
209 * <p>The application must not attempt to read from the array
210 * outside of the specified range.</p>
211 *
212 * @param ch The characters from the XML document.
213 * @param start The start position in the array.
214 * @param length The number of characters to read from the array.
215 * @throws org.xml.sax.SAXException Any SAX exception, possibly
216 * wrapping another exception.
217 * @see #characters
218 */
219 public abstract void ignorableWhitespace (char ch[], int start, int length)
220 throws SAXException;
221
222
223 /**
224 * Receive notification of a processing instruction.
225 *
226 * <p>The Parser will invoke this method once for each processing
227 * instruction found: note that processing instructions may occur
228 * before or after the main document element.</p>
229 *
230 * <p>A SAX parser should never report an XML declaration (XML 1.0,
231 * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
232 * using this method.</p>
233 *
234 * @param target The processing instruction target.
235 * @param data The processing instruction data, or null if
236 * none was supplied.
237 * @throws org.xml.sax.SAXException Any SAX exception, possibly
238 * wrapping another exception.
239 */
240 public abstract void processingInstruction (String target, String data)
241 throws SAXException;
242
243 }
244
245 // end of DocumentHandler.java
|