286N/A/*
286N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A// SAX parser interface.
286N/A// http://www.saxproject.org
286N/A// No warranty; no copyright -- use this as you will.
286N/A// $Id: Parser.java,v 1.2 2004/11/03 22:55:32 jsuttor Exp $
286N/A
286N/Apackage org.xml.sax;
286N/A
286N/Aimport java.io.IOException;
286N/Aimport java.util.Locale;
286N/A
286N/A
286N/A/**
286N/A * Basic interface for SAX (Simple API for XML) parsers.
286N/A *
286N/A * <blockquote>
286N/A * <em>This module, both source code and documentation, is in the
286N/A * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
286N/A * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
286N/A * for further information.
286N/A * </blockquote>
286N/A *
286N/A * <p>This was the main event supplier interface for SAX1; it has
286N/A * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader},
286N/A * which includes Namespace support and sophisticated configurability
286N/A * and extensibility.</p>
286N/A *
286N/A * <p>All SAX1 parsers must implement this basic interface: it allows
286N/A * applications to register handlers for different types of events
286N/A * and to initiate a parse from a URI, or a character stream.</p>
286N/A *
286N/A * <p>All SAX1 parsers must also implement a zero-argument constructor
286N/A * (though other constructors are also allowed).</p>
286N/A *
286N/A * <p>SAX1 parsers are reusable but not re-entrant: the application
286N/A * may reuse a parser object (possibly with a different input source)
286N/A * once the first parse has completed successfully, but it may not
286N/A * invoke the parse() methods recursively within a parse.</p>
286N/A *
286N/A * @deprecated This interface has been replaced by the SAX2
286N/A * {@link org.xml.sax.XMLReader XMLReader}
286N/A * interface, which includes Namespace support.
286N/A * @since SAX 1.0
286N/A * @author David Megginson
286N/A * @see org.xml.sax.EntityResolver
286N/A * @see org.xml.sax.DTDHandler
286N/A * @see org.xml.sax.DocumentHandler
286N/A * @see org.xml.sax.ErrorHandler
286N/A * @see org.xml.sax.HandlerBase
286N/A * @see org.xml.sax.InputSource
286N/A */
286N/Apublic interface Parser
286N/A{
286N/A
286N/A /**
286N/A * Allow an application to request a locale for errors and warnings.
286N/A *
286N/A * <p>SAX parsers are not required to provide localisation for errors
286N/A * and warnings; if they cannot support the requested locale,
286N/A * however, they must throw a SAX exception. Applications may
286N/A * not request a locale change in the middle of a parse.</p>
286N/A *
286N/A * @param locale A Java Locale object.
286N/A * @exception org.xml.sax.SAXException Throws an exception
286N/A * (using the previous or default locale) if the
286N/A * requested locale is not supported.
286N/A * @see org.xml.sax.SAXException
286N/A * @see org.xml.sax.SAXParseException
286N/A */
286N/A public abstract void setLocale (Locale locale)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Allow an application to register a custom entity resolver.
286N/A *
286N/A * <p>If the application does not register an entity resolver, the
286N/A * SAX parser will resolve system identifiers and open connections
286N/A * to entities itself (this is the default behaviour implemented in
286N/A * HandlerBase).</p>
286N/A *
286N/A * <p>Applications may register a new or different entity resolver
286N/A * in the middle of a parse, and the SAX parser must begin using
286N/A * the new resolver immediately.</p>
286N/A *
286N/A * @param resolver The object for resolving entities.
286N/A * @see EntityResolver
286N/A * @see HandlerBase
286N/A */
286N/A public abstract void setEntityResolver (EntityResolver resolver);
286N/A
286N/A
286N/A /**
286N/A * Allow an application to register a DTD event handler.
286N/A *
286N/A * <p>If the application does not register a DTD handler, all DTD
286N/A * events reported by the SAX parser will be silently
286N/A * ignored (this is the default behaviour implemented by
286N/A * HandlerBase).</p>
286N/A *
286N/A * <p>Applications may register a new or different
286N/A * handler in the middle of a parse, and the SAX parser must
286N/A * begin using the new handler immediately.</p>
286N/A *
286N/A * @param handler The DTD handler.
286N/A * @see DTDHandler
286N/A * @see HandlerBase
286N/A */
286N/A public abstract void setDTDHandler (DTDHandler handler);
286N/A
286N/A
286N/A /**
286N/A * Allow an application to register a document event handler.
286N/A *
286N/A * <p>If the application does not register a document handler, all
286N/A * document events reported by the SAX parser will be silently
286N/A * ignored (this is the default behaviour implemented by
286N/A * HandlerBase).</p>
286N/A *
286N/A * <p>Applications may register a new or different handler in the
286N/A * middle of a parse, and the SAX parser must begin using the new
286N/A * handler immediately.</p>
286N/A *
286N/A * @param handler The document handler.
286N/A * @see DocumentHandler
286N/A * @see HandlerBase
286N/A */
286N/A public abstract void setDocumentHandler (DocumentHandler handler);
286N/A
286N/A
286N/A /**
286N/A * Allow an application to register an error event handler.
286N/A *
286N/A * <p>If the application does not register an error event handler,
286N/A * all error events reported by the SAX parser will be silently
286N/A * ignored, except for fatalError, which will throw a SAXException
286N/A * (this is the default behaviour implemented by HandlerBase).</p>
286N/A *
286N/A * <p>Applications may register a new or different handler in the
286N/A * middle of a parse, and the SAX parser must begin using the new
286N/A * handler immediately.</p>
286N/A *
286N/A * @param handler The error handler.
286N/A * @see ErrorHandler
286N/A * @see SAXException
286N/A * @see HandlerBase
286N/A */
286N/A public abstract void setErrorHandler (ErrorHandler handler);
286N/A
286N/A
286N/A /**
286N/A * Parse an XML document.
286N/A *
286N/A * <p>The application can use this method to instruct the SAX parser
286N/A * to begin parsing an XML document from any valid input
286N/A * source (a character stream, a byte stream, or a URI).</p>
286N/A *
286N/A * <p>Applications may not invoke this method while a parse is in
286N/A * progress (they should create a new Parser instead for each
286N/A * additional XML document). Once a parse is complete, an
286N/A * application may reuse the same Parser object, possibly with a
286N/A * different input source.</p>
286N/A *
286N/A * @param source The input source for the top-level of the
286N/A * XML document.
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A * @exception java.io.IOException An IO exception from the parser,
286N/A * possibly from a byte stream or character stream
286N/A * supplied by the application.
286N/A * @see org.xml.sax.InputSource
286N/A * @see #parse(java.lang.String)
286N/A * @see #setEntityResolver
286N/A * @see #setDTDHandler
286N/A * @see #setDocumentHandler
286N/A * @see #setErrorHandler
286N/A */
286N/A public abstract void parse (InputSource source)
286N/A throws SAXException, IOException;
286N/A
286N/A
286N/A /**
286N/A * Parse an XML document from a system identifier (URI).
286N/A *
286N/A * <p>This method is a shortcut for the common case of reading a
286N/A * document from a system identifier. It is the exact
286N/A * equivalent of the following:</p>
286N/A *
286N/A * <pre>
286N/A * parse(new InputSource(systemId));
286N/A * </pre>
286N/A *
286N/A * <p>If the system identifier is a URL, it must be fully resolved
286N/A * by the application before it is passed to the parser.</p>
286N/A *
286N/A * @param systemId The system identifier (URI).
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A * @exception java.io.IOException An IO exception from the parser,
286N/A * possibly from a byte stream or character stream
286N/A * supplied by the application.
286N/A * @see #parse(org.xml.sax.InputSource)
286N/A */
286N/A public abstract void parse (String systemId)
286N/A throws SAXException, IOException;
286N/A
286N/A}
286N/A
286N/A// end of Parser.java