Debian Codegraph @

net/sf/saxon/lib/SourceResolver.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.lib;
9
10 import net.sf.saxon.Configuration;
11 import net.sf.saxon.trans.XPathException;
12
13 import javax.xml.transform.Source;
14
15
16 /**
17 * This interface defines a SourceResolver. A SourceResolver can be registered as
18 * part of the Configuration, and enables new kinds of Source to be recognized
19 * beyond those that are natively recognized by Saxon.
20 * <p>The task of the SourceResolver is to take any Source as input, and to return
21 * a Source that has native support in Saxon: that is, one of the classes
22 * StreamSource, SAXSource, DOMSource, {@link net.sf.saxon.om.NodeInfo},
23 * or {@link net.sf.saxon.pull.PullSource}</p>
24 *
25 * @author Michael H. Kay
26 */
27
28 public interface SourceResolver {
29
30 /**
31 * Resolve a Source.
32 *
33 * @param source A source object, typically the source supplied as the first
34 * argument to {@link javax.xml.transform.Transformer#transform(javax.xml.transform.Source, javax.xml.transform.Result)}
35 * or similar methods.
36 * @param config The Configuration. This provides the SourceResolver with access to
37 * configuration information; it also allows the SourceResolver to invoke the
38 * resolveSource() method on the Configuration object as a fallback implementation.
39 * @return a source object that Saxon knows how to process. This must be an instance of one
40 * of the classes StreamSource, SAXSource, DOMSource, {@link AugmentedSource},
41 * {@link net.sf.saxon.om.NodeInfo},
42 * or {@link net.sf.saxon.pull.PullSource}. Return null if the Source object is not
43 * recognized
44 * @throws XPathException if the Source object is recognized but cannot be processed
45 */
46
47 /*@Nullable*/
48 public Source resolveSource(Source source, Configuration config) throws XPathException;
49
50 }
51