01: package net.sf.saxon;
02:
03: import net.sf.saxon.trans.XPathException;
04:
05: import javax.xml.transform.Source;
06:
07: /**
08: * This interface defines a SourceResolver. A SourceResolver can be registered as
09: * 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)
37: throws XPathException;
38:
39: }
40:
41: //
42: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
43: // you may not use this file except in compliance with the License. You may obtain a copy of the
44: // License at http://www.mozilla.org/MPL/
45: //
46: // Software distributed under the License is distributed on an "AS IS" basis,
47: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
48: // See the License for the specific language governing rights and limitations under the License.
49: //
50: // The Original Code is: all this file.
51: //
52: // The Initial Developer of the Original Code is Michael H. Kay
53: //
54: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
55: //
56: // Contributor(s): none.
57: //
|