Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/xml/sax/ext/Locator2.java
48576 views
/*1* Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425// Locator2.java - extended Locator26// http://www.saxproject.org27// Public Domain: no warranty.28// $Id: Locator2.java,v 1.2 2004/11/03 22:49:08 jsuttor Exp $2930package org.xml.sax.ext;3132import org.xml.sax.Locator;333435/**36* SAX2 extension to augment the entity information provided37* though a {@link Locator}.38* If an implementation supports this extension, the Locator39* provided in {@link org.xml.sax.ContentHandler#setDocumentLocator40* ContentHandler.setDocumentLocator() } will implement this41* interface, and the42* <em>http://xml.org/sax/features/use-locator2</em> feature43* flag will have the value <em>true</em>.44*45* <blockquote>46* <em>This module, both source code and documentation, is in the47* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>48* </blockquote>49*50* <p> XMLReader implementations are not required to support this51* information, and it is not part of core-only SAX2 distributions.</p>52*53* @since SAX 2.0 (extensions 1.1 alpha)54* @author David Brownell55*/56public interface Locator2 extends Locator57{58/**59* Returns the version of XML used for the entity. This will60* normally be the identifier from the current entity's61* <em><?xml version='...' ...?></em> declaration,62* or be defaulted by the parser.63*64* @return Identifier for the XML version being used to interpret65* the entity's text, or null if that information is not yet66* available in the current parsing state.67*/68public String getXMLVersion ();6970/**71* Returns the name of the character encoding for the entity.72* If the encoding was declared externally (for example, in a MIME73* Content-Type header), that will be the name returned. Else if there74* was an <em><?xml ...encoding='...'?></em> declaration at75* the start of the document, that encoding name will be returned.76* Otherwise the encoding will been inferred (normally to be UTF-8, or77* some UTF-16 variant), and that inferred name will be returned.78*79* <p>When an {@link org.xml.sax.InputSource InputSource} is used80* to provide an entity's character stream, this method returns the81* encoding provided in that input stream.82*83* <p> Note that some recent W3C specifications require that text84* in some encodings be normalized, using Unicode Normalization85* Form C, before processing. Such normalization must be performed86* by applications, and would normally be triggered based on the87* value returned by this method.88*89* <p> Encoding names may be those used by the underlying JVM,90* and comparisons should be case-insensitive.91*92* @return Name of the character encoding being used to interpret93* * the entity's text, or null if this was not provided for a *94* character stream passed through an InputSource or is otherwise95* not yet available in the current parsing state.96*/97public String getEncoding ();98}99100101