< prev index next >

src/java.xml/share/classes/org/xml/sax/XMLReader.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2005, 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
  23  * questions.
  24  */
  25 
  26 // XMLReader.java - read an XML document.
  27 // http://www.saxproject.org
  28 // Written by David Megginson
  29 // NO WARRANTY!  This class is in the Public Domain.
  30 // $Id: XMLReader.java,v 1.3 2004/11/03 22:55:32 jsuttor Exp $
  31 
  32 package org.xml.sax;
  33 
  34 import java.io.IOException;
  35 
  36 
  37 /**
  38  * Interface for reading an XML document using callbacks.
  39  *
  40  * <blockquote>
  41  * <em>This module, both source code and documentation, is in the
  42  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
  43  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
  44  * for further information.
  45  * </blockquote>
  46  *
  47  * <p><strong>Note:</strong> despite its name, this interface does
  48  * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
  49  * interface, because reading XML is a fundamentally different activity
  50  * than reading character data.</p>
  51  *
  52  * <p>XMLReader is the interface that an XML parser's SAX2 driver must
  53  * implement.  This interface allows an application to set and
  54  * query features and properties in the parser, to register
  55  * event handlers for document processing, and to initiate
  56  * a document parse.</p>
  57  *
  58  * <p>All SAX interfaces are assumed to be synchronous: the
  59  * {@link #parse parse} methods must not return until parsing
  60  * is complete, and readers must wait for an event-handler callback
  61  * to return before reporting the next event.</p>
  62  *
  63  * <p>This interface replaces the (now deprecated) SAX 1.0 {@link
  64  * org.xml.sax.Parser Parser} interface.  The XMLReader interface
  65  * contains two important enhancements over the old Parser
  66  * interface (as well as some minor ones):</p>
  67  *
  68  * <ol>
  69  * <li>it adds a standard way to query and set features and
  70  *  properties; and</li>
  71  * <li>it adds Namespace support, which is required for many
  72  *  higher-level XML standards.</li>
  73  * </ol>
  74  *
  75  * <p>There are adapters available to convert a SAX1 Parser to
  76  * a SAX2 XMLReader and vice-versa.</p>





  77  *
  78  * @since 1.4, SAX 2.0
  79  * @author David Megginson
  80  * @see org.xml.sax.XMLFilter
  81  * @see org.xml.sax.helpers.ParserAdapter
  82  * @see org.xml.sax.helpers.XMLReaderAdapter
  83  */
  84 public interface XMLReader
  85 {
  86 
  87 
  88     ////////////////////////////////////////////////////////////////////
  89     // Configuration.
  90     ////////////////////////////////////////////////////////////////////
  91 
  92 
  93     /**
  94      * Look up the value of a feature flag.
  95      *
  96      * <p>The feature name is any fully-qualified URI.  It is


   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
  23  * questions.
  24  */
  25 






  26 package org.xml.sax;
  27 
  28 import java.io.IOException;
  29 
  30 
  31 /**
  32  * Interface for reading an XML document using callbacks.
  33  *











  34  *
  35  * <p>XMLReader is the interface that an XML parser's SAX2 driver must
  36  * implement.  This interface allows an application to set and
  37  * query features and properties in the parser, to register
  38  * event handlers for document processing, and to initiate
  39  * a document parse.</p>
  40  *
  41  * <p>All SAX interfaces are assumed to be synchronous: the
  42  * {@link #parse parse} methods must not return until parsing
  43  * is complete, and readers must wait for an event-handler callback
  44  * to return before reporting the next event.</p>
  45  *
  46  * <p>This interface replaces the (now deprecated) SAX 1.0 {@link
  47  * org.xml.sax.Parser Parser} interface.  The XMLReader interface
  48  * contains two important enhancements over the old Parser
  49  * interface (as well as some minor ones):</p>
  50  *
  51  * <ol>
  52  * <li>it adds a standard way to query and set features and
  53  *  properties; and</li>
  54  * <li>it adds Namespace support, which is required for many
  55  *  higher-level XML standards.</li>
  56  * </ol>
  57  *
  58  * <p>There are adapters available to convert a SAX1 Parser to
  59  * a SAX2 XMLReader and vice-versa.</p>
  60  *
  61  * @apiNote Despite its name, this interface does
  62  * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
  63  * interface, because reading XML is a fundamentally different activity
  64  * than reading character data.
  65  *
  66  * @since 1.4, SAX 2.0
  67  * @author David Megginson
  68  * @see org.xml.sax.XMLFilter
  69  * @see org.xml.sax.helpers.ParserAdapter
  70  * @see org.xml.sax.helpers.XMLReaderAdapter
  71  */
  72 public interface XMLReader
  73 {
  74 
  75 
  76     ////////////////////////////////////////////////////////////////////
  77     // Configuration.
  78     ////////////////////////////////////////////////////////////////////
  79 
  80 
  81     /**
  82      * Look up the value of a feature flag.
  83      *
  84      * <p>The feature name is any fully-qualified URI.  It is


< prev index next >