Package net.sf.saxon.resource
Class AbstractResourceCollection
java.lang.Object
net.sf.saxon.resource.AbstractResourceCollection
- All Implemented Interfaces:
ResourceCollection
- Direct Known Subclasses:
CatalogCollection,DirectoryCollection,JarCollection
AbstractCollection is an abstract superclass for the various implementations
of ResourceCollection within Saxon. It provides common services such as
mapping of file extensions to MIME types, and mapping of MIME types to
resource factories.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Configurationprotected URIQueryParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the URI of the collectionprotected AbstractResourceCollection.InputDetailsgetInputDetails(String resourceURI) protected Stringprotected StringguessContentTypeFromName(String resourceURI) booleanisStable(XPathContext context) Ask whether the collection is stable.makeResource(Configuration config, String resourceURI) Default method to make a resource, given a resource URImakeResource(Configuration config, AbstractResourceCollection.InputDetails details) Internal method to make a resource for a single entry in the ZIP or JAR file.makeTypedResource(Configuration config, Resource basicResource) protected ParseOptionsoptionsFromQueryParameters(URIQueryParameters params, XPathContext context) voidregisterContentType(String contentType, ResourceFactory factory) Associate a media type with a resource factory.static voidsetupErrorHandlingForCollection(ParseOptions options, int onError, UnfailingErrorListener oldErrorListener) booleanSupply information about the whitespace stripping rules that apply to this collection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.lib.ResourceCollection
getResources, getResourceURIs
-
Field Details
-
config
-
collectionURI
-
params
-
-
Constructor Details
-
AbstractResourceCollection
-
-
Method Details
-
getCollectionURI
Description copied from interface:ResourceCollectionGet the URI of the collection- Specified by:
getCollectionURIin interfaceResourceCollection- Returns:
- The URI as passed to the fn:collection() or fn:uri-collection() function, resolved if it is relative against the static base URI. If the collection() or uri-collection() function was called with no arguments (to get the "default collection") this will be the URI of the default collection registered with the Configuration.
-
isStable
Ask whether the collection is stable. This method should only be called after callingResourceCollection.getResources(XPathContext)orResourceCollection.getResourceURIs(XPathContext)- Specified by:
isStablein interfaceResourceCollection- Parameters:
context- the XPath evaluation context.- Returns:
- true if the collection is defined to be stable, that is, if a subsequent call
on collection() with the same URI is guaranteed to return the same result. The method returns
true if the query parameter stable=yes is present in the URI, or if the configuration property
FeatureKeys.STABLE_COLLECTION_URIis set.
-
registerContentType
Associate a media type with a resource factory. Since 9.7.0.6 this registers the content type with the configuration, making the register of content types more accessible to applications.- Parameters:
contentType- a media type or MIME type, for example application/xsd+xmlfactory- a ResourceFactory used to parse (or otherwise process) resources of that type
-
optionsFromQueryParameters
-
setupErrorHandlingForCollection
public static void setupErrorHandlingForCollection(ParseOptions options, int onError, UnfailingErrorListener oldErrorListener) -
getInputDetails
protected AbstractResourceCollection.InputDetails getInputDetails(String resourceURI) throws XPathException - Throws:
XPathException
-
guessContentTypeFromName
-
guessContentTypeFromContent
-
makeResource
public Resource makeResource(Configuration config, AbstractResourceCollection.InputDetails details) throws XPathException Internal method to make a resource for a single entry in the ZIP or JAR file. This involves making decisions about the type of resource. This method can be overridden in a user-defined subclass.- Parameters:
config- The Saxon configurationdetails- Details of the input.- Returns:
- a newly created Resource representing the content of this entry in the ZIP or JAR file
- Throws:
XPathException
-
makeTypedResource
public Resource makeTypedResource(Configuration config, Resource basicResource) throws XPathException - Throws:
XPathException
-
makeResource
Default method to make a resource, given a resource URI- Parameters:
resourceURI- the resource URI- Returns:
- the corresponding resource
- Throws:
XPathException
-
stripWhitespace
Supply information about the whitespace stripping rules that apply to this collection. This method will only be called when the collection() function is invoked from XSLT.- Specified by:
stripWhitespacein interfaceResourceCollection- Parameters:
rules- the space-stripping rules that apply to this collection, derived from the xsl:strip-space and xsl:preserve-space declarations in the stylesheet package containing the call to the collection() function.- Returns:
- true if the collection finder intends to take responsibility for whitespace stripping according to these rules; false if it wishes Saxon itself to post-process any returned XML documents to strip whitespace. Returning true may either indicate that the collection finder will strip whitespace before returning a document, or it may indicate that it does not wish the space stripping rules to be applied. The default (returned by this method if not overridden) is false.
-