Debian Codegraph @

net/sf/saxon/lib/SchemaURIResolver.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 * A SchemaURIResolver is used when resolving references to
18 * schema documents. It takes as input the target namespace of the schema to be loaded, and a set of
19 * location hints as input, and returns one or more Source obects containing the schema documents
20 * to be imported.
21 *
22 * @author Michael H. Kay
23 */
24
25 public interface SchemaURIResolver {
26
27 /**
28 * Set the configuration information for use by the resolver
29 *
30 * @param config the Saxon Configuration (which will always be an {@link com.saxonica.config.EnterpriseConfiguration})
31 */
32
33 void setConfiguration(Configuration config);
34
35 /**
36 * Resolve a URI identifying a schema document, given the target namespace URI and
37 * a set of associated location hints.
38 *
39 * @param targetNamespace the target namespaces of the schema to be imported. The "null namesapce"
40 * is identified by a zero-length string. In the case of an xsd:include directive, where no
41 * target namespace is specified, the parameter is null.
42 * @param baseURI The base URI of the module containing the "import schema" declaration;
43 * null if no base URI is known
44 * @param locations The set of URIs identified as schema location hints. In most cases (xs:include, xs:import,
45 * xsi:schemaLocation, xsl:import-schema) there is only one URI in this list. With an XQuery "import module"
46 * declaration, however, a list of URIs may be specified.
47 * @return an array of Source objects each identifying a schema document to be loaded.
48 * These need not necessarily correspond one-to-one with the location hints provided.
49 * Returning a zero-length array indictates that no schema documents should be loaded (perhaps because
50 * the relevant schema components are already present in the schema cache).
51 * The method may also return null to indicate that resolution should be delegated to the standard
52 * (Saxon-supplied) SchemaURIResolver.
53 * @throws net.sf.saxon.trans.XPathException
54 * if the module cannot be located, and if delegation to the default
55 * module resolver is not required.
56 */
57
58 Source[] resolve(String targetNamespace, String baseURI, String[] locations) throws XPathException;
59
60
61 }
62