Package net.sf.saxon.resource
Class UnparsedTextResource
- java.lang.Object
-
- net.sf.saxon.resource.UnparsedTextResource
-
- All Implemented Interfaces:
Resource
public class UnparsedTextResource extends java.lang.Object implements Resource
This class implements th interface Resource. We handle unparded text here. The Resource objects belong to a collection It is used to support the fn:collection() and fn:uri-collection() functions.- Since:
- 9.7
-
-
Field Summary
Fields Modifier and Type Field Description static ResourceFactory
FACTORY
-
Constructor Summary
Constructors Constructor Description UnparsedTextResource(java.lang.String uri, java.lang.String content)
UnparsedTextResource(AbstractResourceCollection.InputDetails details)
Create an UnparsedTextResource
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getContent()
java.lang.String
getContentType()
Get the media type (MIME type) of the resource if knownjava.lang.String
getEncoding()
Item
getItem()
Get an XDM Item holding the contents of this resource.java.lang.String
getResourceURI()
Get a URI that identifies this resource
-
-
-
Field Detail
-
FACTORY
public static final ResourceFactory FACTORY
-
-
Constructor Detail
-
UnparsedTextResource
public UnparsedTextResource(AbstractResourceCollection.InputDetails details) throws XPathException
Create an UnparsedTextResource- Parameters:
details
- information about the input- Throws:
XPathException
- for an unsupported encoding
-
UnparsedTextResource
public UnparsedTextResource(java.lang.String uri, java.lang.String content)
-
-
Method Detail
-
getResourceURI
public java.lang.String getResourceURI()
Description copied from interface:Resource
Get a URI that identifies this resource- Specified by:
getResourceURI
in interfaceResource
- Returns:
- a URI identifying this resource
-
getEncoding
public java.lang.String getEncoding()
-
getContent
public java.lang.String getContent() throws XPathException
- Throws:
XPathException
-
getItem
public Item getItem() throws XPathException
Description copied from interface:Resource
Get an XDM Item holding the contents of this resource.- Specified by:
getItem
in interfaceResource
- 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
public java.lang.String getContentType()
Get the media type (MIME type) of the resource if known- Specified by:
getContentType
in interfaceResource
- Returns:
- the string "text/plain"
-
-