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 document handler.
286N/A// http://www.saxproject.org
286N/A// No warranty; no copyright -- use this as you will.
286N/A// $Id: DocumentHandler.java,v 1.2 2004/11/03 22:44:51 jsuttor Exp $
286N/A
286N/Apackage org.xml.sax;
286N/A
286N/A/**
286N/A * Receive notification of general document events.
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-handling interface for SAX1; in
286N/A * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler
286N/A * ContentHandler}, which provides Namespace support and reporting
286N/A * of skipped entities. This interface is included in SAX2 only
286N/A * to support legacy SAX1 applications.</p>
286N/A *
286N/A * <p>The order of events in this interface is very important, and
286N/A * mirrors the order of information in the document itself. For
286N/A * example, all of an element's content (character data, processing
286N/A * instructions, and/or subelements) will appear, in order, between
286N/A * the startElement event and the corresponding endElement event.</p>
286N/A *
286N/A * <p>Application writers who do not want to implement the entire
286N/A * interface can derive a class from HandlerBase, which implements
286N/A * the default functionality; parser writers can instantiate
286N/A * HandlerBase to obtain a default handler. The application can find
286N/A * the location of any document event using the Locator interface
286N/A * supplied by the Parser through the setDocumentLocator method.</p>
286N/A *
286N/A * @deprecated This interface has been replaced by the SAX2
286N/A * {@link org.xml.sax.ContentHandler ContentHandler}
286N/A * interface, which includes Namespace support.
286N/A * @since SAX 1.0
286N/A * @author David Megginson
286N/A * @see org.xml.sax.Parser#setDocumentHandler
286N/A * @see org.xml.sax.Locator
286N/A * @see org.xml.sax.HandlerBase
286N/A */
286N/Apublic interface DocumentHandler {
286N/A
286N/A
286N/A /**
286N/A * Receive an object for locating the origin of SAX document events.
286N/A *
286N/A * <p>SAX parsers are strongly encouraged (though not absolutely
286N/A * required) to supply a locator: if it does so, it must supply
286N/A * the locator to the application by invoking this method before
286N/A * invoking any of the other methods in the DocumentHandler
286N/A * interface.</p>
286N/A *
286N/A * <p>The locator allows the application to determine the end
286N/A * position of any document-related event, even if the parser is
286N/A * not reporting an error. Typically, the application will
286N/A * use this information for reporting its own errors (such as
286N/A * character content that does not match an application's
286N/A * business rules). The information returned by the locator
286N/A * is probably not sufficient for use with a search engine.</p>
286N/A *
286N/A * <p>Note that the locator will return correct information only
286N/A * during the invocation of the events in this interface. The
286N/A * application should not attempt to use it at any other time.</p>
286N/A *
286N/A * @param locator An object that can return the location of
286N/A * any SAX document event.
286N/A * @see org.xml.sax.Locator
286N/A */
286N/A public abstract void setDocumentLocator (Locator locator);
286N/A
286N/A
286N/A /**
286N/A * Receive notification of the beginning of a document.
286N/A *
286N/A * <p>The SAX parser will invoke this method only once, before any
286N/A * other methods in this interface or in DTDHandler (except for
286N/A * setDocumentLocator).</p>
286N/A *
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A */
286N/A public abstract void startDocument ()
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Receive notification of the end of a document.
286N/A *
286N/A * <p>The SAX parser will invoke this method only once, and it will
286N/A * be the last method invoked during the parse. The parser shall
286N/A * not invoke this method until it has either abandoned parsing
286N/A * (because of an unrecoverable error) or reached the end of
286N/A * input.</p>
286N/A *
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A */
286N/A public abstract void endDocument ()
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Receive notification of the beginning of an element.
286N/A *
286N/A * <p>The Parser will invoke this method at the beginning of every
286N/A * element in the XML document; there will be a corresponding
286N/A * endElement() event for every startElement() event (even when the
286N/A * element is empty). All of the element's content will be
286N/A * reported, in order, before the corresponding endElement()
286N/A * event.</p>
286N/A *
286N/A * <p>If the element name has a namespace prefix, the prefix will
286N/A * still be attached. Note that the attribute list provided will
286N/A * contain only attributes with explicit values (specified or
286N/A * defaulted): #IMPLIED attributes will be omitted.</p>
286N/A *
286N/A * @param name The element type name.
286N/A * @param atts The attributes attached to the element, if any.
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A * @see #endElement
286N/A * @see org.xml.sax.AttributeList
286N/A */
286N/A public abstract void startElement (String name, AttributeList atts)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Receive notification of the end of an element.
286N/A *
286N/A * <p>The SAX parser will invoke this method at the end of every
286N/A * element in the XML document; there will be a corresponding
286N/A * startElement() event for every endElement() event (even when the
286N/A * element is empty).</p>
286N/A *
286N/A * <p>If the element name has a namespace prefix, the prefix will
286N/A * still be attached to the name.</p>
286N/A *
286N/A * @param name The element type name
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A */
286N/A public abstract void endElement (String name)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Receive notification of character data.
286N/A *
286N/A * <p>The Parser will call this method to report each chunk of
286N/A * character data. SAX parsers may return all contiguous character
286N/A * data in a single chunk, or they may split it into several
286N/A * chunks; however, all of the characters in any single event
286N/A * must come from the same external entity, so that the Locator
286N/A * provides useful information.</p>
286N/A *
286N/A * <p>The application must not attempt to read from the array
286N/A * outside of the specified range.</p>
286N/A *
286N/A * <p>Note that some parsers will report whitespace using the
286N/A * ignorableWhitespace() method rather than this one (validating
286N/A * parsers must do so).</p>
286N/A *
286N/A * @param ch The characters from the XML document.
286N/A * @param start The start position in the array.
286N/A * @param length The number of characters to read from the array.
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A * @see #ignorableWhitespace
286N/A * @see org.xml.sax.Locator
286N/A */
286N/A public abstract void characters (char ch[], int start, int length)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Receive notification of ignorable whitespace in element content.
286N/A *
286N/A * <p>Validating Parsers must use this method to report each chunk
286N/A * of ignorable whitespace (see the W3C XML 1.0 recommendation,
286N/A * section 2.10): non-validating parsers may also use this method
286N/A * if they are capable of parsing and using content models.</p>
286N/A *
286N/A * <p>SAX parsers may return all contiguous whitespace in a single
286N/A * chunk, or they may split it into several chunks; however, all of
286N/A * the characters in any single event must come from the same
286N/A * external entity, so that the Locator provides useful
286N/A * information.</p>
286N/A *
286N/A * <p>The application must not attempt to read from the array
286N/A * outside of the specified range.</p>
286N/A *
286N/A * @param ch The characters from the XML document.
286N/A * @param start The start position in the array.
286N/A * @param length The number of characters to read from the array.
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A * @see #characters
286N/A */
286N/A public abstract void ignorableWhitespace (char ch[], int start, int length)
286N/A throws SAXException;
286N/A
286N/A
286N/A /**
286N/A * Receive notification of a processing instruction.
286N/A *
286N/A * <p>The Parser will invoke this method once for each processing
286N/A * instruction found: note that processing instructions may occur
286N/A * before or after the main document element.</p>
286N/A *
286N/A * <p>A SAX parser should never report an XML declaration (XML 1.0,
286N/A * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
286N/A * using this method.</p>
286N/A *
286N/A * @param target The processing instruction target.
286N/A * @param data The processing instruction data, or null if
286N/A * none was supplied.
286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly
286N/A * wrapping another exception.
286N/A */
286N/A public abstract void processingInstruction (String target, String data)
286N/A throws SAXException;
286N/A
286N/A}
286N/A
286N/A// end of DocumentHandler.java