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 * 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 * 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 * 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 * 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// No warranty; no copyright -- use this as you will. 286N/A * Basic interface for resolving entities. 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 * for further information. 286N/A * <p>If a SAX application needs to implement customized handling 286N/A * for external entities, it must implement this interface and 286N/A * register an instance with the SAX driver using the 286N/A * <p>The XML reader will then allow the application to intercept any 286N/A * external entities (including the external DTD subset and external 286N/A * parameter entities, if any) before including them.</p> 286N/A * <p>Many SAX applications will not need to implement this interface, 286N/A * but it will be especially useful for applications that build 286N/A * XML documents from databases or other specialised input sources, 286N/A * or for applications that use URI types other than URLs.</p> 286N/A * <p>The following resolver would provide the application 286N/A * with a special character stream for the entity with the system 286N/A * public class MyResolver implements EntityResolver { 286N/A * public InputSource resolveEntity (String publicId, String systemId) 286N/A * // return a special input source 286N/A * MyReader reader = new MyReader(); 286N/A * return new InputSource(reader); 286N/A * // use the default behaviour 286N/A * <p>The application can also use this interface to redirect system 286N/A * identifiers to local URIs or to look up replacements in a catalog 286N/A * (possibly by using the public identifier).</p> 286N/A * @author David Megginson 286N/A * Allow the application to resolve external entities. 286N/A * <p>The parser will call this method before opening any external 286N/A * entity except the top-level document entity. Such entities include 286N/A * the external DTD subset and external parameter entities referenced 286N/A * within the DTD (in either case, only if the parser reads external 286N/A * parameter entities), and external general entities referenced 286N/A * within the document element (if the parser reads external general 286N/A * entities). The application may request that the parser locate 286N/A * the entity itself, that it use an alternative URI, or that it 286N/A * use data provided by the application (as a character or byte 286N/A * <p>Application writers can use this method to redirect external 286N/A * system identifiers to secure and/or local URIs, to look up 286N/A * public identifiers in a catalogue, or to read an entity from a 286N/A * database or other input source (including, for example, a dialog 286N/A * box). Neither XML nor SAX specifies a preferred policy for using 286N/A * public or system IDs to resolve resources. However, SAX specifies 286N/A * how to interpret any InputSource returned by this method, and that 286N/A * if none is returned, then the system ID will be dereferenced as 286N/A * <p>If the system identifier is a URL, the SAX parser must 286N/A * resolve it fully before reporting it to the application.</p> 286N/A * @param publicId The public identifier of the external entity 286N/A * being referenced, or null if none was supplied. 286N/A * @param systemId The system identifier of the external entity 286N/A * @return An InputSource object describing the new input source, 286N/A * or null to request that the parser open a regular 286N/A * URI connection to the system identifier. 286N/A * @exception org.xml.sax.SAXException Any SAX exception, possibly 286N/A * wrapping another exception. 286N/A * @exception java.io.IOException A Java-specific IO exception, 286N/A * possibly the result of creating a new InputStream 286N/A * or Reader for the InputSource.