net.sf.kernow.transform
Class CustomStandardCollectionURIResolver

java.lang.Object
  extended by net.sf.kernow.transform.CustomStandardCollectionURIResolver
All Implemented Interfaces:
java.io.Serializable, net.sf.saxon.CollectionURIResolver

public class CustomStandardCollectionURIResolver
extends java.lang.Object
implements net.sf.saxon.CollectionURIResolver

This class implements the default collection URI Resolver.

This supports two implementations of collections. If the URI supplied uses the "file:/" scheme, and the file that is referenced is a directory, then the collection is the set of files in that directory. Query parameters may be included in the URI:

Otherwise, the resolver attempts to dereference the URI to obtain a catalog file. This is an XML file containing a list of documents, in the format:

 <collection>
   <doc href="doc1.xml"/>
   <doc href="doc2.xml"/>
 </collection>
 

See Also:
Serialized Form

Constructor Summary
CustomStandardCollectionURIResolver()
           
 
Method Summary
 net.sf.saxon.om.SequenceIterator resolve(java.lang.String href, java.lang.String base, net.sf.saxon.expr.XPathContext context)
          Resolve a URI.
 void setCustomEntityResolver(CustomEntityResolver customEntityResolver)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomStandardCollectionURIResolver

public CustomStandardCollectionURIResolver()
Method Detail

resolve

public net.sf.saxon.om.SequenceIterator resolve(java.lang.String href,
                                                java.lang.String base,
                                                net.sf.saxon.expr.XPathContext context)
                                         throws net.sf.saxon.trans.XPathException
Resolve a URI.

Specified by:
resolve in interface net.sf.saxon.CollectionURIResolver
Parameters:
href - The relative URI of the collection. This corresponds to the argument supplied to the collection() function. If the collection() function was called with no arguments (to get the "default collection") this argument will be null.
base - The base URI that should be used. This is the base URI of the static context in which the call to collection() was made, typically the URI of the stylesheet or query module
Returns:
an Iterator over the documents in the collection. The items returned by this iterator must be instances either of xs:anyURI, or of node() (specifically, NodeInfo.). If xs:anyURI values are returned, the corresponding document will be retrieved as if by a call to the doc() function: this means that the system first checks to see if the document is already loaded, and if not, calls the registered URIResolver to dereference the URI. This is the recommended approach to ensure that the resulting collection is stable: however, it has the consequence that the documents will by default remain in memory for the duration of the query or transformation.
Throws:
net.sf.saxon.trans.XPathException

setCustomEntityResolver

public void setCustomEntityResolver(CustomEntityResolver customEntityResolver)