768N/A/*
2362N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
768N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
768N/A *
768N/A * This code is free software; you can redistribute it and/or modify it
768N/A * under the terms of the GNU General Public License version 2 only, as
768N/A * published by the Free Software Foundation. Oracle designates this
768N/A * particular file as subject to the "Classpath" exception as provided
768N/A * by Oracle in the LICENSE file that accompanied this code.
768N/A *
768N/A * This code is distributed in the hope that it will be useful, but WITHOUT
768N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
768N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
768N/A * version 2 for more details (a copy is included in the LICENSE file that
768N/A * accompanied this code).
768N/A *
768N/A * You should have received a copy of the GNU General Public License version
768N/A * 2 along with this work; if not, write to the Free Software Foundation,
2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2362N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
768N/A * or visit www.oracle.com if you need additional information or have any
768N/A * questions.
768N/A */
768N/A
768N/A// SAX locator interface for document events.
768N/A// http://www.saxproject.org
768N/A// No warranty; no copyright -- use this as you will.
768N/A// $Id: Locator.java,v 1.2 2004/11/03 22:55:32 jsuttor Exp $
768N/A
768N/Apackage org.xml.sax;
768N/A
768N/A
768N/A/**
768N/A * Interface for associating a SAX event with a document location.
768N/A *
768N/A * <blockquote>
768N/A * <em>This module, both source code and documentation, is in the
768N/A * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
768N/A * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
768N/A * for further information.
768N/A * </blockquote>
768N/A *
768N/A * <p>If a SAX parser provides location information to the SAX
768N/A * application, it does so by implementing this interface and then
768N/A * passing an instance to the application using the content
768N/A * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator
768N/A * setDocumentLocator} method. The application can use the
768N/A * object to obtain the location of any other SAX event
768N/A * in the XML source document.</p>
768N/A *
768N/A * <p>Note that the results returned by the object will be valid only
768N/A * during the scope of each callback method: the application
768N/A * will receive unpredictable results if it attempts to use the
768N/A * locator at any other time, or after parsing completes.</p>
768N/A *
768N/A * <p>SAX parsers are not required to supply a locator, but they are
768N/A * very strongly encouraged to do so. If the parser supplies a
768N/A * locator, it must do so before reporting any other document events.
768N/A * If no locator has been set by the time the application receives
768N/A * the {@link org.xml.sax.ContentHandler#startDocument startDocument}
768N/A * event, the application should assume that a locator is not
768N/A * available.</p>
768N/A *
768N/A * @since SAX 1.0
768N/A * @author David Megginson
768N/A * @see org.xml.sax.ContentHandler#setDocumentLocator
768N/A */
768N/Apublic interface Locator {
768N/A
768N/A
768N/A /**
768N/A * Return the public identifier for the current document event.
768N/A *
768N/A * <p>The return value is the public identifier of the document
768N/A * entity or of the external parsed entity in which the markup
768N/A * triggering the event appears.</p>
768N/A *
768N/A * @return A string containing the public identifier, or
768N/A * null if none is available.
768N/A * @see #getSystemId
768N/A */
768N/A public abstract String getPublicId ();
768N/A
768N/A
768N/A /**
768N/A * Return the system identifier for the current document event.
768N/A *
768N/A * <p>The return value is the system identifier of the document
768N/A * entity or of the external parsed entity in which the markup
768N/A * triggering the event appears.</p>
768N/A *
768N/A * <p>If the system identifier is a URL, the parser must resolve it
768N/A * fully before passing it to the application. For example, a file
768N/A * name must always be provided as a <em>file:...</em> URL, and other
768N/A * kinds of relative URI are also resolved against their bases.</p>
768N/A *
768N/A * @return A string containing the system identifier, or null
768N/A * if none is available.
768N/A * @see #getPublicId
768N/A */
768N/A public abstract String getSystemId ();
768N/A
768N/A
768N/A /**
768N/A * Return the line number where the current document event ends.
768N/A * Lines are delimited by line ends, which are defined in
* the XML specification.
*
* <p><strong>Warning:</strong> The return value from the method
* is intended only as an approximation for the sake of diagnostics;
* it is not intended to provide sufficient information
* to edit the character content of the original XML document.
* In some cases, these "line" numbers match what would be displayed
* as columns, and in others they may not match the source text
* due to internal entity expansion. </p>
*
* <p>The return value is an approximation of the line number
* in the document entity or external parsed entity where the
* markup triggering the event appears.</p>
*
* <p>If possible, the SAX driver should provide the line position
* of the first character after the text associated with the document
* event. The first line is line 1.</p>
*
* @return The line number, or -1 if none is available.
* @see #getColumnNumber
*/
public abstract int getLineNumber ();
/**
* Return the column number where the current document event ends.
* This is one-based number of Java <code>char</code> values since
* the last line end.
*
* <p><strong>Warning:</strong> The return value from the method
* is intended only as an approximation for the sake of diagnostics;
* it is not intended to provide sufficient information
* to edit the character content of the original XML document.
* For example, when lines contain combining character sequences, wide
* characters, surrogate pairs, or bi-directional text, the value may
* not correspond to the column in a text editor's display. </p>
*
* <p>The return value is an approximation of the column number
* in the document entity or external parsed entity where the
* markup triggering the event appears.</p>
*
* <p>If possible, the SAX driver should provide the line position
* of the first character after the text associated with the document
* event. The first column in each line is column 1.</p>
*
* @return The column number, or -1 if none is available.
* @see #getLineNumber
*/
public abstract int getColumnNumber ();
}
// end of Locator.java