Saxon.Api

 

 

Saxon.Api

Interface IResource


public interface IResource

This interface defines a Resource. The Resource objects typically 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 an IResource should be delayed until the GetXdmItem 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.

For deterministic behavior and conformance with W3C Recommendations, it is strongly recommended that repeated calls on GetXdmItem should deliver the same result (if the result is a node, it should be the same node each time). This can be achieved by caching the result. However, this can be expensive in use of memory, and Saxon does not attempt to enforce this rule.

Property Summary

 string ContentType

The media type (MIME type) of the resource if known (otherwise null)

 Uri ResourceUri

A URI that identifies this resource

 

Method Summary

 XdmItem GetXdmItem (DynamicContext context)

Get an XDM Item holding the contents of this resource.

 

Property Detail

ContentType

public string ContentType {get; }

The media type (MIME type) of the resource if known (otherwise null)

ResourceUri

public Uri ResourceUri {get; }

A URI that identifies this resource

Method Detail

GetXdmItem

public XdmItem GetXdmItem(DynamicContext context)

Get an XDM Item holding the contents of this resource.

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.