Debian Codegraph @

net/sf/saxon/lib/CollectionURIResolver.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.expr.XPathContext;
11 import net.sf.saxon.om.Item;
12 import net.sf.saxon.om.SequenceIterator;
13 import net.sf.saxon.trans.XPathException;
14
15
16 /**
17 * This interface defines a CollectionURIResolver. This is a counterpart to the JAXP
18 * URIResolver, but is used to map the URI of collection into a sequence of documents.
19 * It is used to support the fn:collection() and fn:uri-collection() functions.
20 * @deprecated since 9.7: use {@link CollectionFinder}.
21 * @since 9.7: the interface is retained for backwards compatibility, but does not
22 * provide access to the full capabilities of collections in XPath 3.1
23 */
24
25 public interface CollectionURIResolver {
26
27 /**
28 * Resolve a URI.
29 *
30 * @param href The relative URI of the collection. This corresponds to the
31 * argument supplied to the collection() function. If the collection() function
32 * was called with no arguments (to get the "default collection") this argument
33 * will be null.
34 * @param base The base URI that should be used. This is the base URI of the
35 * static context in which the call to collection() was made, typically the URI
36 * of the stylesheet or query module
37 * @param context The dynamic execution context
38 * @return an Iterator over the documents in the collection. The items returned
39 * by this iterator must be instances either of xs:anyURI, or of node() (specifically,
40 * {@link net.sf.saxon.om.NodeInfo}).
41 * <p>When the fn:uri-collection() function is called: the result will consist of
42 * (a) any items that are xs:anyURI values, and (b) the document URIs of any items that are
43 * document nodes with a document URI.</p>
44 * <p>When the fn:collection() function is called: if xs:anyURI values are returned, the corresponding
45 * document will be retrieved as if by a call to the fn:doc() function: this means that
46 * the system first checks to see if the document is already loaded, and if not, calls
47 * the registered URIResolver to dereference the URI. This is the recommended approach
48 * to ensure that the resulting collection is stable: however, it has the consequence
49 * that the documents will by default remain in memory for the duration of the query
50 * or transformation.</p>
51 * <p>
52 * If the collection URI is not recognized, the method may either return an empty iterator,
53 * in which case no error is reported, or it may throw an exception, in which case
54 * the query or transformation fails. Returning null has the same effect as returning
55 * an empty iterator.</p>
56 * @throws net.sf.saxon.trans.XPathException if any failure occurs
57 */
58
59
60 SequenceIterator<?> resolve(String href, String base, XPathContext context) throws XPathException;
61
62
63 }
64