Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/w3c/dom/ls/LSResourceResolver.java
86410 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/*25* This file is available under and governed by the GNU General Public26* License version 2 only, as published by the Free Software Foundation.27* However, the following notice accompanied the original version of this28* file and, per its terms, should not be removed:29*30* Copyright (c) 2004 World Wide Web Consortium,31*32* (Massachusetts Institute of Technology, European Research Consortium for33* Informatics and Mathematics, Keio University). All Rights Reserved. This34* work is distributed under the W3C(r) Software License [1] in the hope that35* it will be useful, but WITHOUT ANY WARRANTY; without even the implied36* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.37*38* [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-2002123139*/4041package org.w3c.dom.ls;4243/**44* <code>LSResourceResolver</code> provides a way for applications to45* redirect references to external resources.46* <p> Applications needing to implement custom handling for external47* resources can implement this interface and register their implementation48* by setting the "resource-resolver" parameter of49* <code>DOMConfiguration</code> objects attached to <code>LSParser</code>50* and <code>LSSerializer</code>. It can also be register on51* <code>DOMConfiguration</code> objects attached to <code>Document</code>52* if the "LS" feature is supported.53* <p> The <code>LSParser</code> will then allow the application to intercept54* any external entities, including the external DTD subset and external55* parameter entities, before including them. The top-level document entity56* is never passed to the <code>resolveResource</code> method.57* <p> Many DOM applications will not need to implement this interface, but it58* will be especially useful for applications that build XML documents from59* databases or other specialized input sources, or for applications that60* use URNs.61* <p ><b>Note:</b> <code>LSResourceResolver</code> is based on the SAX2 [<a href='http://www.saxproject.org/'>SAX</a>] <code>EntityResolver</code>62* interface.63* <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>Document Object Model (DOM) Level 3 Load64and Save Specification</a>.65*/66public interface LSResourceResolver {67/**68* Allow the application to resolve external resources.69* <br> The <code>LSParser</code> will call this method before opening any70* external resource, including the external DTD subset, external71* entities referenced within the DTD, and external entities referenced72* within the document element (however, the top-level document entity73* is not passed to this method). The application may then request that74* the <code>LSParser</code> resolve the external resource itself, that75* it use an alternative URI, or that it use an entirely different input76* source.77* <br> Application writers can use this method to redirect external78* system identifiers to secure and/or local URI, to look up public79* identifiers in a catalogue, or to read an entity from a database or80* other input source (including, for example, a dialog box).81* @param type The type of the resource being resolved. For XML [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] resources82* (i.e. entities), applications must use the value83* <code>"http://www.w3.org/TR/REC-xml"</code>. For XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]84* , applications must use the value85* <code>"http://www.w3.org/2001/XMLSchema"</code>. Other types of86* resources are outside the scope of this specification and therefore87* should recommend an absolute URI in order to use this method.88* @param namespaceURI The namespace of the resource being resolved,89* e.g. the target namespace of the XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>]90* when resolving XML Schema resources.91* @param publicId The public identifier of the external entity being92* referenced, or <code>null</code> if no public identifier was93* supplied or if the resource is not an entity.94* @param systemId The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], of the95* external resource being referenced, or <code>null</code> if no96* system identifier was supplied.97* @param baseURI The absolute base URI of the resource being parsed, or98* <code>null</code> if there is no base URI.99* @return A <code>LSInput</code> object describing the new input100* source, or <code>null</code> to request that the parser open a101* regular URI connection to the resource.102*/103public LSInput resolveResource(String type,104String namespaceURI,105String publicId,106String systemId,107String baseURI);108109}110111112