Package net.sf.saxon.resource
Class JSONResource
- java.lang.Object
-
- net.sf.saxon.resource.JSONResource
-
-
Field Summary
Fields Modifier and Type Field Description static ResourceFactoryFACTORY
-
Constructor Summary
Constructors Constructor Description JSONResource(AbstractResourceCollection.InputDetails details)Create the resource
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContentType()Get the media type (MIME type) of the resource if knownItemgetItem(XPathContext context)Get an XDM Item holding the contents of this resource.java.lang.StringgetResourceURI()Get a URI that identifies this resource
-
-
-
Field Detail
-
FACTORY
public static final ResourceFactory FACTORY
-
-
Constructor Detail
-
JSONResource
public JSONResource(AbstractResourceCollection.InputDetails details)
Create the resource- Parameters:
details- the inputstream holding the JSON content plus details of encoding etc
-
-
Method Detail
-
getResourceURI
public java.lang.String getResourceURI()
Description copied from interface:ResourceGet a URI that identifies this resource- Specified by:
getResourceURIin interfaceResource- Returns:
- a URI identifying this resource
-
getItem
public Item getItem(XPathContext context) throws XPathException
Description copied from interface:ResourceGet an XDM Item holding the contents of this resource.- Specified by:
getItemin interfaceResource- Parameters:
context- the XPath evaluation context- 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
-
getContentType
public java.lang.String getContentType()
Get the media type (MIME type) of the resource if known- Specified by:
getContentTypein interfaceResource- Returns:
- the string "application/json"
-
-