1 /* |
1 /* |
2 * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. |
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. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 // ContentHandler.java - handle main document content. |
|
27 // http://www.saxproject.org |
|
28 // Written by David Megginson |
|
29 // NO WARRANTY! This class is in the public domain. |
|
30 // $Id: ContentHandler.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $ |
|
31 |
|
32 package org.xml.sax; |
26 package org.xml.sax; |
33 |
27 |
34 |
28 |
35 /** |
29 /** |
36 * Receive notification of the logical content of a document. |
30 * Receive notification of the logical content of a document. |
37 * |
|
38 * <blockquote> |
|
39 * <em>This module, both source code and documentation, is in the |
|
40 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> |
|
41 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> |
|
42 * for further information. |
|
43 * </blockquote> |
|
44 * |
31 * |
45 * <p>This is the main interface that most SAX applications |
32 * <p>This is the main interface that most SAX applications |
46 * implement: if the application needs to be informed of basic parsing |
33 * implement: if the application needs to be informed of basic parsing |
47 * events, it implements this interface and registers an instance with |
34 * events, it implements this interface and registers an instance with |
48 * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler |
35 * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler |
124 * @see #endDocument |
111 * @see #endDocument |
125 */ |
112 */ |
126 public void startDocument () |
113 public void startDocument () |
127 throws SAXException; |
114 throws SAXException; |
128 |
115 |
|
116 /** |
|
117 * Receives notification of the XML declaration. |
|
118 * |
|
119 * @implSpec |
|
120 * The default implementation in the SAX API is to do nothing. |
|
121 * |
|
122 * @param version the version string as in the input document, null if not |
|
123 * specified |
|
124 * @param encoding the encoding string as in the input document, null if not |
|
125 * specified |
|
126 * @param standalone the standalone string as in the input document, null if |
|
127 * not specified |
|
128 * |
|
129 * @throws SAXException if the application wants to report an error or |
|
130 * interrupt the parsing process |
|
131 * |
|
132 * @since 14 |
|
133 */ |
|
134 default void declaration(String version, String encoding, String standalone) |
|
135 throws SAXException |
|
136 { |
|
137 //no op |
|
138 } |
129 |
139 |
130 /** |
140 /** |
131 * Receive notification of the end of a document. |
141 * Receive notification of the end of a document. |
132 * |
142 * |
133 * <p><strong>There is an apparent contradiction between the |
143 * <p> |
134 * documentation for this method and the documentation for {@link |
144 * This method is invoked by the parser to signal it has reached the end of |
135 * org.xml.sax.ErrorHandler#fatalError}. Until this ambiguity is |
145 * the document after successfully completing the parsing process. |
136 * resolved in a future major release, clients should make no |
146 * After the event, the parser will return the control to the application. |
137 * assumptions about whether endDocument() will or will not be |
147 * |
138 * invoked when the parser has reported a fatalError() or thrown |
148 * @apiNote In case of a fatal error, the parser may choose to stop the |
139 * an exception.</strong></p> |
149 * parsing process with a {@link SAXException}, in which case, this method |
140 * |
150 * will never be called. Refer to |
141 * <p>The SAX parser will invoke this method only once, and it will |
151 * {@link ErrorHandler#fatalError(org.xml.sax.SAXParseException)}. |
142 * be the last method invoked during the parse. The parser shall |
|
143 * not invoke this method until it has either abandoned parsing |
|
144 * (because of an unrecoverable error) or reached the end of |
|
145 * input.</p> |
|
146 * |
152 * |
147 * @throws org.xml.sax.SAXException any SAX exception, possibly |
153 * @throws org.xml.sax.SAXException any SAX exception, possibly |
148 * wrapping another exception |
154 * wrapping another exception |
149 * @see #startDocument |
155 * @see #startDocument |
150 */ |
156 */ |