http://www.zorba-xquery.com/modules/node-reference

Description

Before using any of the functions below please remember to import the module namespace:

import module namespace ref = "http://www.zorba-xquery.com/modules/node-reference";
The module provides functions to compute an immutable and opaque reference for any node and to retrieve nodes given their identifier. The identifiers are immutable, i.e. a node identifier does not change during the node lifetime and cannot be reused for another node after the original node gets deleted. Identifiers are unique, in that, two different nodes will never have the same identifier. A node, at any time during its lifetime, can be retrieved by its identifier.

Please see the data lifecycle documentation about details on storing nodes in collections or as documents.

See also

Data Lifecycle

Author

Federico Cavalieri

XQuery version and encoding

xquery version "1.0" encoding "utf-8";

Namespaces

refhttp://www.zorba-xquery.com/modules/node-reference
verhttp://www.zorba-xquery.com/options/versioning
zerrhttp://www.zorba-xquery.com/errors

Function Summary

 node-by-reference($arg as xs:anyURI) as node()? external

Returns the node identified by the given node reference.

 node-reference($arg as node()) as xs:anyURI external

Returns an immutable and opaque node reference (with type xs:anyURI) for a given node.

Functions

node-by-reference#1

declare function ref:node-by-reference(
    $arg as xs:anyURI
) as node()? external

Returns the node identified by the given node reference.

The function returns the empty sequence if the node that is referenced does not exist.

Parameters

  • $arg as xs:anyURI
    the URI of the node to retrieve.

Returns

  • node()?

    the node identified by the URI passed as parameter or the empty-sequence if no node with that URI is found.

Errors

  • zerr:ZAPI0028 if the given URI is not a valid node reference computed by the ref:node-reference function.

node-reference#1

declare function ref:node-reference(
    $arg as node()
) as xs:anyURI external

Returns an immutable and opaque node reference (with type xs:anyURI) for a given node.

The generated identifier is immutable, i.e. a node identifier does not change during the node lifetime and cannot be reused for another node after the original node gets deleted.

Identifiers are also unique, in that, two different nodes will never have the same identifier.

A node, at any time during its lifetime, can be retrieved by its identifier, using the ref:node-by-reference function.

Parameters

  • $arg as node()
    the node for which the URI should be computed

Returns

  • xs:anyURI

    the opaque URI of the node.

blog comments powered by Disqus