jaxp/src/share/classes/org/xml/sax/XMLReader.java
author kvn
Fri, 20 Jun 2008 11:10:05 -0700
changeset 762 1b26adb5fea1
parent 6 7f561c08de6b
permissions -rw-r--r--
6715633: when matching a memory node the adr_type should not change Summary: verify the adr_type of a mach node was not changed Reviewed-by: rasbold, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 * have any questions.
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
// XMLReader.java - read an XML document.
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
// http://www.saxproject.org
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
// Written by David Megginson
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
// NO WARRANTY!  This class is in the Public Domain.
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
// $Id: XMLReader.java,v 1.3 2004/11/03 22:55:32 jsuttor Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
package org.xml.sax;
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
import java.io.IOException;
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * Interface for reading an XML document using callbacks.
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * <blockquote>
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * <em>This module, both source code and documentation, is in the
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * for further information.
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * </blockquote>
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * <p><strong>Note:</strong> despite its name, this interface does
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 * interface, because reading XML is a fundamentally different activity
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * than reading character data.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 * <p>XMLReader is the interface that an XML parser's SAX2 driver must
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * implement.  This interface allows an application to set and
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 * query features and properties in the parser, to register
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 * event handlers for document processing, and to initiate
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 * a document parse.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
 * <p>All SAX interfaces are assumed to be synchronous: the
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
 * {@link #parse parse} methods must not return until parsing
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
 * is complete, and readers must wait for an event-handler callback
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
 * to return before reporting the next event.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
 * <p>This interface replaces the (now deprecated) SAX 1.0 {@link
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
 * org.xml.sax.Parser Parser} interface.  The XMLReader interface
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
 * contains two important enhancements over the old Parser
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
 * interface (as well as some minor ones):</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
 * <ol>
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
 * <li>it adds a standard way to query and set features and
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
 *  properties; and</li>
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
 * <li>it adds Namespace support, which is required for many
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
 *  higher-level XML standards.</li>
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
 * </ol>
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
 * <p>There are adapters available to convert a SAX1 Parser to
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
 * a SAX2 XMLReader and vice-versa.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
 * @since SAX 2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
 * @author David Megginson
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
 * @see org.xml.sax.XMLFilter
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
 * @see org.xml.sax.helpers.ParserAdapter
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
 * @see org.xml.sax.helpers.XMLReaderAdapter
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
public interface XMLReader
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
{
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
    // Configuration.
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
     * Look up the value of a feature flag.
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
     * <p>The feature name is any fully-qualified URI.  It is
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
     * possible for an XMLReader to recognize a feature name but
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
     * temporarily be unable to return its value.
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
     * Some feature values may be available only in specific
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
     * contexts, such as before, during, or after a parse.
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
     * Also, some feature values may not be programmatically accessible.
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
     * (In the case of an adapter for SAX1 {@link Parser}, there is no
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
     * implementation-independent way to expose whether the underlying
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
     * parser is performing validation, expanding external entities,
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
     * and so forth.) </p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
     * <p>All XMLReaders are required to recognize the
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
     * http://xml.org/sax/features/namespaces and the
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
     * http://xml.org/sax/features/namespace-prefixes feature names.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
     * <p>Typical usage is something like this:</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
     * <pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
     * XMLReader r = new MySAXDriver();
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
     *                         // try to activate validation
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
     * try {
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
     *   r.setFeature("http://xml.org/sax/features/validation", true);
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
     * } catch (SAXException e) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
     *   System.err.println("Cannot activate validation.");
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
     * }
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
     *                         // register event handlers
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
     * r.setContentHandler(new MyContentHandler());
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
     * r.setErrorHandler(new MyErrorHandler());
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
     *                         // parse the first document
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
     * try {
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
     *   r.parse("http://www.foo.com/mydoc.xml");
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
     * } catch (IOException e) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
     *   System.err.println("I/O exception reading XML document");
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
     * } catch (SAXException e) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
     *   System.err.println("XML exception reading document.");
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
     * }
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
     * </pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
     * <p>Implementors are free (and encouraged) to invent their own features,
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
     * using names built on their own URIs.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
     * @param name The feature name, which is a fully-qualified URI.
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
     * @return The current value of the feature (true or false).
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
     * @exception org.xml.sax.SAXNotRecognizedException If the feature
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
     *            value can't be assigned or retrieved.
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
     * @exception org.xml.sax.SAXNotSupportedException When the
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
     *            XMLReader recognizes the feature name but
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
     *            cannot determine its value at this time.
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
     * @see #setFeature
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
    public boolean getFeature (String name)
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
        throws SAXNotRecognizedException, SAXNotSupportedException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
     * Set the value of a feature flag.
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
     * <p>The feature name is any fully-qualified URI.  It is
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
     * possible for an XMLReader to expose a feature value but
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
     * to be unable to change the current value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
     * Some feature values may be immutable or mutable only
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
     * in specific contexts, such as before, during, or after
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
     * a parse.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
     * <p>All XMLReaders are required to support setting
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
     * http://xml.org/sax/features/namespaces to true and
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
     * http://xml.org/sax/features/namespace-prefixes to false.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
     * @param name The feature name, which is a fully-qualified URI.
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
     * @param value The requested value of the feature (true or false).
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
     * @exception org.xml.sax.SAXNotRecognizedException If the feature
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
     *            value can't be assigned or retrieved.
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
     * @exception org.xml.sax.SAXNotSupportedException When the
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
     *            XMLReader recognizes the feature name but
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
     *            cannot set the requested value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
     * @see #getFeature
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
    public void setFeature (String name, boolean value)
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
        throws SAXNotRecognizedException, SAXNotSupportedException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
     * Look up the value of a property.
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
     * <p>The property name is any fully-qualified URI.  It is
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
     * possible for an XMLReader to recognize a property name but
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
     * temporarily be unable to return its value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
     * Some property values may be available only in specific
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
     * contexts, such as before, during, or after a parse.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
     * <p>XMLReaders are not required to recognize any specific
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
     * property names, though an initial core set is documented for
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
     * SAX2.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
     * <p>Implementors are free (and encouraged) to invent their own properties,
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
     * using names built on their own URIs.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
     * @param name The property name, which is a fully-qualified URI.
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
     * @return The current value of the property.
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
     * @exception org.xml.sax.SAXNotRecognizedException If the property
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
     *            value can't be assigned or retrieved.
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
     * @exception org.xml.sax.SAXNotSupportedException When the
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
     *            XMLReader recognizes the property name but
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
     *            cannot determine its value at this time.
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
     * @see #setProperty
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
    public Object getProperty (String name)
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
        throws SAXNotRecognizedException, SAXNotSupportedException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
     * Set the value of a property.
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
     * <p>The property name is any fully-qualified URI.  It is
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
     * possible for an XMLReader to recognize a property name but
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
     * to be unable to change the current value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
     * Some property values may be immutable or mutable only
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
     * in specific contexts, such as before, during, or after
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
     * a parse.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
     * <p>XMLReaders are not required to recognize setting
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
     * any specific property names, though a core set is defined by
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
     * SAX2.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
     * <p>This method is also the standard mechanism for setting
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
     * extended handlers.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
     * @param name The property name, which is a fully-qualified URI.
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
     * @param value The requested value for the property.
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
     * @exception org.xml.sax.SAXNotRecognizedException If the property
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
     *            value can't be assigned or retrieved.
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
     * @exception org.xml.sax.SAXNotSupportedException When the
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
     *            XMLReader recognizes the property name but
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
     *            cannot set the requested value.
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
    public void setProperty (String name, Object value)
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
        throws SAXNotRecognizedException, SAXNotSupportedException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
    // Event handlers.
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
     * Allow an application to register an entity resolver.
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
     * <p>If the application does not register an entity resolver,
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
     * the XMLReader will perform its own default resolution.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
     * <p>Applications may register a new or different resolver in the
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
     * middle of a parse, and the SAX parser must begin using the new
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
     * resolver immediately.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
     * @param resolver The entity resolver.
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
     * @see #getEntityResolver
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
    public void setEntityResolver (EntityResolver resolver);
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
     * Return the current entity resolver.
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
     * @return The current entity resolver, or null if none
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
     *         has been registered.
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
     * @see #setEntityResolver
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
    public EntityResolver getEntityResolver ();
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
     * Allow an application to register a DTD event handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
     * <p>If the application does not register a DTD handler, all DTD
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
     * events reported by the SAX parser will be silently ignored.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
     * <p>Applications may register a new or different handler in the
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
     * middle of a parse, and the SAX parser must begin using the new
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
     * handler immediately.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
     * @param handler The DTD handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
     * @see #getDTDHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
    public void setDTDHandler (DTDHandler handler);
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
     * Return the current DTD handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
     * @return The current DTD handler, or null if none
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
     *         has been registered.
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
     * @see #setDTDHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
    public DTDHandler getDTDHandler ();
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   297
     * Allow an application to register a content event handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   298
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   299
     * <p>If the application does not register a content handler, all
7f561c08de6b Initial load
duke
parents:
diff changeset
   300
     * content events reported by the SAX parser will be silently
7f561c08de6b Initial load
duke
parents:
diff changeset
   301
     * ignored.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   302
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   303
     * <p>Applications may register a new or different handler in the
7f561c08de6b Initial load
duke
parents:
diff changeset
   304
     * middle of a parse, and the SAX parser must begin using the new
7f561c08de6b Initial load
duke
parents:
diff changeset
   305
     * handler immediately.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   306
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   307
     * @param handler The content handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   308
     * @see #getContentHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   309
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
    public void setContentHandler (ContentHandler handler);
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
7f561c08de6b Initial load
duke
parents:
diff changeset
   312
7f561c08de6b Initial load
duke
parents:
diff changeset
   313
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
     * Return the current content handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
     * @return The current content handler, or null if none
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
     *         has been registered.
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
     * @see #setContentHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
    public ContentHandler getContentHandler ();
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
     * Allow an application to register an error event handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
     * <p>If the application does not register an error handler, all
7f561c08de6b Initial load
duke
parents:
diff changeset
   327
     * error events reported by the SAX parser will be silently
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
     * ignored; however, normal processing may not continue.  It is
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
     * highly recommended that all SAX applications implement an
7f561c08de6b Initial load
duke
parents:
diff changeset
   330
     * error handler to avoid unexpected bugs.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
     * <p>Applications may register a new or different handler in the
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
     * middle of a parse, and the SAX parser must begin using the new
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
     * handler immediately.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
     * @param handler The error handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
     * @see #getErrorHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
    public void setErrorHandler (ErrorHandler handler);
7f561c08de6b Initial load
duke
parents:
diff changeset
   340
7f561c08de6b Initial load
duke
parents:
diff changeset
   341
7f561c08de6b Initial load
duke
parents:
diff changeset
   342
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   343
     * Return the current error handler.
7f561c08de6b Initial load
duke
parents:
diff changeset
   344
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   345
     * @return The current error handler, or null if none
7f561c08de6b Initial load
duke
parents:
diff changeset
   346
     *         has been registered.
7f561c08de6b Initial load
duke
parents:
diff changeset
   347
     * @see #setErrorHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   348
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   349
    public ErrorHandler getErrorHandler ();
7f561c08de6b Initial load
duke
parents:
diff changeset
   350
7f561c08de6b Initial load
duke
parents:
diff changeset
   351
7f561c08de6b Initial load
duke
parents:
diff changeset
   352
7f561c08de6b Initial load
duke
parents:
diff changeset
   353
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   354
    // Parsing.
7f561c08de6b Initial load
duke
parents:
diff changeset
   355
    ////////////////////////////////////////////////////////////////////
7f561c08de6b Initial load
duke
parents:
diff changeset
   356
7f561c08de6b Initial load
duke
parents:
diff changeset
   357
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   358
     * Parse an XML document.
7f561c08de6b Initial load
duke
parents:
diff changeset
   359
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   360
     * <p>The application can use this method to instruct the XML
7f561c08de6b Initial load
duke
parents:
diff changeset
   361
     * reader to begin parsing an XML document from any valid input
7f561c08de6b Initial load
duke
parents:
diff changeset
   362
     * source (a character stream, a byte stream, or a URI).</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   363
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   364
     * <p>Applications may not invoke this method while a parse is in
7f561c08de6b Initial load
duke
parents:
diff changeset
   365
     * progress (they should create a new XMLReader instead for each
7f561c08de6b Initial load
duke
parents:
diff changeset
   366
     * nested XML document).  Once a parse is complete, an
7f561c08de6b Initial load
duke
parents:
diff changeset
   367
     * application may reuse the same XMLReader object, possibly with a
7f561c08de6b Initial load
duke
parents:
diff changeset
   368
     * different input source.
7f561c08de6b Initial load
duke
parents:
diff changeset
   369
     * Configuration of the XMLReader object (such as handler bindings and
7f561c08de6b Initial load
duke
parents:
diff changeset
   370
     * values established for feature flags and properties) is unchanged
7f561c08de6b Initial load
duke
parents:
diff changeset
   371
     * by completion of a parse, unless the definition of that aspect of
7f561c08de6b Initial load
duke
parents:
diff changeset
   372
     * the configuration explicitly specifies other behavior.
7f561c08de6b Initial load
duke
parents:
diff changeset
   373
     * (For example, feature flags or properties exposing
7f561c08de6b Initial load
duke
parents:
diff changeset
   374
     * characteristics of the document being parsed.)
7f561c08de6b Initial load
duke
parents:
diff changeset
   375
     * </p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   376
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   377
     * <p>During the parse, the XMLReader will provide information
7f561c08de6b Initial load
duke
parents:
diff changeset
   378
     * about the XML document through the registered event
7f561c08de6b Initial load
duke
parents:
diff changeset
   379
     * handlers.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   380
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   381
     * <p>This method is synchronous: it will not return until parsing
7f561c08de6b Initial load
duke
parents:
diff changeset
   382
     * has ended.  If a client application wants to terminate
7f561c08de6b Initial load
duke
parents:
diff changeset
   383
     * parsing early, it should throw an exception.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   384
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   385
     * @param input The input source for the top-level of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   386
     *        XML document.
7f561c08de6b Initial load
duke
parents:
diff changeset
   387
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
7f561c08de6b Initial load
duke
parents:
diff changeset
   388
     *            wrapping another exception.
7f561c08de6b Initial load
duke
parents:
diff changeset
   389
     * @exception java.io.IOException An IO exception from the parser,
7f561c08de6b Initial load
duke
parents:
diff changeset
   390
     *            possibly from a byte stream or character stream
7f561c08de6b Initial load
duke
parents:
diff changeset
   391
     *            supplied by the application.
7f561c08de6b Initial load
duke
parents:
diff changeset
   392
     * @see org.xml.sax.InputSource
7f561c08de6b Initial load
duke
parents:
diff changeset
   393
     * @see #parse(java.lang.String)
7f561c08de6b Initial load
duke
parents:
diff changeset
   394
     * @see #setEntityResolver
7f561c08de6b Initial load
duke
parents:
diff changeset
   395
     * @see #setDTDHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   396
     * @see #setContentHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   397
     * @see #setErrorHandler
7f561c08de6b Initial load
duke
parents:
diff changeset
   398
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   399
    public void parse (InputSource input)
7f561c08de6b Initial load
duke
parents:
diff changeset
   400
        throws IOException, SAXException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   401
7f561c08de6b Initial load
duke
parents:
diff changeset
   402
7f561c08de6b Initial load
duke
parents:
diff changeset
   403
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   404
     * Parse an XML document from a system identifier (URI).
7f561c08de6b Initial load
duke
parents:
diff changeset
   405
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   406
     * <p>This method is a shortcut for the common case of reading a
7f561c08de6b Initial load
duke
parents:
diff changeset
   407
     * document from a system identifier.  It is the exact
7f561c08de6b Initial load
duke
parents:
diff changeset
   408
     * equivalent of the following:</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   409
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   410
     * <pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
   411
     * parse(new InputSource(systemId));
7f561c08de6b Initial load
duke
parents:
diff changeset
   412
     * </pre>
7f561c08de6b Initial load
duke
parents:
diff changeset
   413
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   414
     * <p>If the system identifier is a URL, it must be fully resolved
7f561c08de6b Initial load
duke
parents:
diff changeset
   415
     * by the application before it is passed to the parser.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   416
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   417
     * @param systemId The system identifier (URI).
7f561c08de6b Initial load
duke
parents:
diff changeset
   418
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
7f561c08de6b Initial load
duke
parents:
diff changeset
   419
     *            wrapping another exception.
7f561c08de6b Initial load
duke
parents:
diff changeset
   420
     * @exception java.io.IOException An IO exception from the parser,
7f561c08de6b Initial load
duke
parents:
diff changeset
   421
     *            possibly from a byte stream or character stream
7f561c08de6b Initial load
duke
parents:
diff changeset
   422
     *            supplied by the application.
7f561c08de6b Initial load
duke
parents:
diff changeset
   423
     * @see #parse(org.xml.sax.InputSource)
7f561c08de6b Initial load
duke
parents:
diff changeset
   424
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   425
    public void parse (String systemId)
7f561c08de6b Initial load
duke
parents:
diff changeset
   426
        throws IOException, SAXException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   427
7f561c08de6b Initial load
duke
parents:
diff changeset
   428
}