1 package net.sf.saxon; 2 import net.sf.saxon.trans.XPathException; 3 4 import javax.xml.transform.Source; 5 6 7 /** 8 * This interface defines a SourceResolver. A SourceResolver can be registered as 9 * part of the Configuration, and enables new kinds of Source to be recognized 10 * beyond those that are natively recognized by Saxon. 11 * <p> 12 * The task of the SourceResolver is to take any Source as input, and to return 13 * a Source that has native support in Saxon: that is, one of the classes 14 * StreamSource, SAXSource, DOMSource, {@link net.sf.saxon.om.NodeInfo}, 15 * or {@link net.sf.saxon.pull.PullSource} 16 * @author Michael H. Kay 17 */ 18 19 public interface SourceResolver { 20 21 /** 22 * Resolve a Source. 23 * @param source A source object, typically the source supplied as the first 24 * argument to {@link javax.xml.transform.Transformer#transform(javax.xml.transform.Source, javax.xml.transform.Result)} 25 * or similar methods. 26 * @param config The Configuration. This provides the SourceResolver with access to 27 * configuration information; it also allows the SourceResolver to invoke the 28 * resolveSource() method on the Configuration object as a fallback implementation. 29 * @return a source object that Saxon knows how to process. This must be an instance of one 30 * of the classes StreamSource, SAXSource, DOMSource {@link net.sf.saxon.om.NodeInfo}, 31 * or {@link net.sf.saxon.pull.PullSource}. Return null if the Source object is not 32 * recognized 33 * @throws XPathException if the Source object is recognized but cannot be processed 34 */ 35 36 public Source resolveSource(Source source, Configuration config) throws XPathException; 37 38 } 39 40 41 42 43 44 // 45 // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License"); 46 // you may not use this file except in compliance with the License. You may obtain a copy of the 47 // License at http://www.mozilla.org/MPL/ 48 // 49 // Software distributed under the License is distributed on an "AS IS" basis, 50 // WITHOUT WARRANTY OF ANY KIND, either express or implied. 51 // See the License for the specific language governing rights and limitations under the License. 52 // 53 // The Original Code is: all this file. 54 // 55 // The Initial Developer of the Original Code is Michael H. Kay 56 // 57 // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved. 58 // 59 // Contributor(s): none. 60 // 61