Package net.sf.saxon.lib
Interface Resource
-
- All Known Implementing Classes:
BinaryResource
,FailedResource
,JSONResource
,MetadataResource
,UnknownResource
,UnparsedTextResource
,XmlResource
public interface Resource
This interface defines a Resource. The Resource objects belong to a collection. It is used to support the fn:collection() and fn:uri-collection() functions.It is recommended (but is not universally the case) that fetching (and where necessary parsing) the content of a Resource should be delayed until the
getItem()
method is called. This means that errors in fetching the resource or parsing its contents may go undetected until the resource is materialized in this way.- Since:
- 9.7
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getContentType()
Get the media type (MIME type) of the resource if knownItem
getItem()
Get an XDM Item holding the contents of this resource.java.lang.String
getResourceURI()
Get a URI that identifies this resource
-
-
-
Method Detail
-
getResourceURI
java.lang.String getResourceURI()
Get a URI that identifies this resource- Returns:
- a URI identifying this resource
-
getItem
Item getItem() throws XPathException
Get an XDM Item holding the contents of this resource.- Returns:
- an item holding the contents of the resource. The type of item will reflect the type of the resource: a document node for XML resources, a string for text resources, a map or array for JSON resources, a base64Binary value for binary resource. May also return null if the resource cannot be materialized and this is not to be treated as an error.
- Throws:
XPathException
- if a failure occurs materializing the resource, and errors are to be treated as fatal
-
getContentType
java.lang.String getContentType()
Get the media type (MIME type) of the resource if known- Returns:
- the media type if known; otherwise null
-
-