jaxp/src/org/xml/sax/ext/Locator2.java
changeset 12457 c348e06f0e82
parent 12005 a754d69d5e60
child 25262 1fe892ba017a
equal deleted inserted replaced
12324:1d7e6da6adc8 12457:c348e06f0e82
       
     1 /*
       
     2  * Copyright (c) 2004, 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 // Locator2.java - extended Locator
       
    27 // http://www.saxproject.org
       
    28 // Public Domain: no warranty.
       
    29 // $Id: Locator2.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $
       
    30 
       
    31 package org.xml.sax.ext;
       
    32 
       
    33 import org.xml.sax.Locator;
       
    34 
       
    35 
       
    36 /**
       
    37  * SAX2 extension to augment the entity information provided
       
    38  * though a {@link Locator}.
       
    39  * If an implementation supports this extension, the Locator
       
    40  * provided in {@link org.xml.sax.ContentHandler#setDocumentLocator
       
    41  * ContentHandler.setDocumentLocator() } will implement this
       
    42  * interface, and the
       
    43  * <em>http://xml.org/sax/features/use-locator2</em> feature
       
    44  * flag will have the value <em>true</em>.
       
    45  *
       
    46  * <blockquote>
       
    47  * <em>This module, both source code and documentation, is in the
       
    48  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
       
    49  * </blockquote>
       
    50  *
       
    51  * <p> XMLReader implementations are not required to support this
       
    52  * information, and it is not part of core-only SAX2 distributions.</p>
       
    53  *
       
    54  * @since SAX 2.0 (extensions 1.1 alpha)
       
    55  * @author David Brownell
       
    56  */
       
    57 public interface Locator2 extends Locator
       
    58 {
       
    59     /**
       
    60      * Returns the version of XML used for the entity.  This will
       
    61      * normally be the identifier from the current entity's
       
    62      * <em>&lt;?xml&nbsp;version='...'&nbsp;...?&gt;</em> declaration,
       
    63      * or be defaulted by the parser.
       
    64      *
       
    65      * @return Identifier for the XML version being used to interpret
       
    66      * the entity's text, or null if that information is not yet
       
    67      * available in the current parsing state.
       
    68      */
       
    69     public String getXMLVersion ();
       
    70 
       
    71     /**
       
    72      * Returns the name of the character encoding for the entity.
       
    73      * If the encoding was declared externally (for example, in a MIME
       
    74      * Content-Type header), that will be the name returned.  Else if there
       
    75      * was an <em>&lt;?xml&nbsp;...encoding='...'?&gt;</em> declaration at
       
    76      * the start of the document, that encoding name will be returned.
       
    77      * Otherwise the encoding will been inferred (normally to be UTF-8, or
       
    78      * some UTF-16 variant), and that inferred name will be returned.
       
    79      *
       
    80      * <p>When an {@link org.xml.sax.InputSource InputSource} is used
       
    81      * to provide an entity's character stream, this method returns the
       
    82      * encoding provided in that input stream.
       
    83      *
       
    84      * <p> Note that some recent W3C specifications require that text
       
    85      * in some encodings be normalized, using Unicode Normalization
       
    86      * Form C, before processing.  Such normalization must be performed
       
    87      * by applications, and would normally be triggered based on the
       
    88      * value returned by this method.
       
    89      *
       
    90      * <p> Encoding names may be those used by the underlying JVM,
       
    91      * and comparisons should be case-insensitive.
       
    92      *
       
    93      * @return Name of the character encoding being used to interpret
       
    94      * * the entity's text, or null if this was not provided for a *
       
    95      * character stream passed through an InputSource or is otherwise
       
    96      * not yet available in the current parsing state.
       
    97      */
       
    98     public String getEncoding ();
       
    99 }