public abstract class AbstractResourceCollection extends java.lang.Object implements ResourceCollection
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractResourceCollection.InputDetails
Information about a resource
|
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
collectionURI |
protected Configuration |
config |
protected URIQueryParameters |
params |
| Constructor and Description |
|---|
AbstractResourceCollection(Configuration config)
Create a resource collection
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCollectionURI()
Get the URI of the collection
|
protected AbstractResourceCollection.InputDetails |
getInputDetails(java.lang.String resourceURI)
Get details of a resource given the resource URI
|
protected java.lang.String |
guessContentTypeFromContent(java.io.InputStream stream)
Attempt to establish the media type of a resource, given the actual content.
|
protected java.lang.String |
guessContentTypeFromName(java.lang.String resourceURI)
Attempt to establish the media type of a resource, given the resource URI.
|
boolean |
isStable(XPathContext context)
Ask whether the collection is stable.
|
Resource |
makeResource(Configuration config,
AbstractResourceCollection.InputDetails details)
Internal method to make a resource for a single entry in the ZIP or JAR file.
|
Resource |
makeResource(Configuration config,
java.lang.String resourceURI)
Default method to make a resource, given a resource URI
|
Resource |
makeTypedResource(Configuration config,
Resource basicResource)
Given a resource whose type may be unknown, create a Resource of a specific type,
for example an XML or JSON resource
|
protected ParseOptions |
optionsFromQueryParameters(URIQueryParameters params,
XPathContext context)
Analyze URI query parameters and convert them to a set of parser options
|
void |
registerContentType(java.lang.String contentType,
ResourceFactory factory)
Associate a media type with a resource factory.
|
static void |
setupErrorHandlingForCollection(ParseOptions options,
int onError,
ErrorReporter oldErrorListener) |
boolean |
stripWhitespace(SpaceStrippingRule rules)
Supply information about the whitespace stripping rules that apply to this collection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetResources, getResourceURIsprotected Configuration config
protected java.lang.String collectionURI
protected URIQueryParameters params
public AbstractResourceCollection(Configuration config)
config - the Saxon configurationpublic java.lang.String getCollectionURI()
ResourceCollectiongetCollectionURI in interface ResourceCollectionpublic boolean isStable(XPathContext context)
ResourceCollection.getResources(XPathContext) or ResourceCollection.getResourceURIs(XPathContext)isStable in interface ResourceCollectioncontext - the XPath evaluation context.FeatureKeys.STABLE_COLLECTION_URI is set.public void registerContentType(java.lang.String contentType,
ResourceFactory factory)
contentType - a media type or MIME type, for example application/xsd+xmlfactory - a ResourceFactory used to parse (or otherwise process) resources of that typeprotected ParseOptions optionsFromQueryParameters(URIQueryParameters params, XPathContext context)
params - the query parameters extracted from the URIcontext - the XPath evaluation contextpublic static void setupErrorHandlingForCollection(ParseOptions options, int onError, ErrorReporter oldErrorListener)
protected AbstractResourceCollection.InputDetails getInputDetails(java.lang.String resourceURI) throws XPathException
resourceURI - the resource URIXPathException - if the information cannot be obtainedprotected java.lang.String guessContentTypeFromName(java.lang.String resourceURI)
URLConnection#guessContentTypeFromName, and failing that
the mapping from file extensions to media types held in the Saxon ConfigurationresourceURI - the resource URIprotected java.lang.String guessContentTypeFromContent(java.io.InputStream stream)
URLConnection#guessContentTypeFromStreamstream - the input stream. This should be positioned at the start; the
reading position is not affected by the call.public Resource makeResource(Configuration config, AbstractResourceCollection.InputDetails details) throws XPathException
config - The Saxon configurationdetails - Details of the input.XPathExceptionpublic Resource makeTypedResource(Configuration config, Resource basicResource) throws XPathException
config - the Saxon ConfigurationbasicResource - the resource, whose type may be unknownXPathException - if a failure occurs (for example an XML or JSON parsing failure)public Resource makeResource(Configuration config, java.lang.String resourceURI) throws XPathException
resourceURI - the resource URIXPathExceptionpublic boolean stripWhitespace(SpaceStrippingRule rules)
stripWhitespace in interface ResourceCollectionrules - 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.Copyright (c) 2004-2021 Saxonica Limited. All rights reserved.