[All Packages]  [This Package]

Class: XPath

This class contains top-level methods for invoking the XPath processor.


Method Index

XPath XPath constructor
~XPath Deletes the XPath object
parsexpathexpr Parses an XPath expression
evalxpathexpr Evaluates an already parsed XPath expression

Methods


XPath

Purpose

Creates an XPath object.

Syntax
XPath (xmlctx *ctx, xmlnode *xslnode, 
       xmlnode* xml_node, oratext* baseURI, 
       size_t nctxels, xmlnode ** ctxnodes);

Parameters

ctx      (IN) - XSL context. Could be NULL. 
xslnode  (IN) - The XSL node to be used for namespace expansion. 
                Could be set to NULL.
xmlnode  (IN) - The context node. Set to NULL for parsing.
baseURI  (IN) - The base URI for parsing.
nctxels  (IN) - The number of nodes in the current node set. 
ctxnodes (IN) - The current node set.
Returns

An XPath object. This call never fails.  

~XPath

Purpose

Deletes an XPath object.

Syntax
delete ();


parsexpathexpr

Purpose

Parses an XPath expression.

Syntax
xpexpr *parsexpathexpr (oratext *expr, sword *err);

Parameters

expr (IN)     - The expression in the form of a string.
err  (OUT)    - The error code.
Returns

On success, returns the expression tree. On failure, returns NULL.  

evalxpathexpr

Purpose

Evaluates an XPath expression.

Syntax
XPObject *evalxpathexpr (xpexpr *exprtree, sword *err);

Parameters

exprtree (IN)     - The expression in the form of a tree.
err      (OUT)    - The error code.
Returns

On success, returns the result object. On failure, returns NULL.  
Notes

The type of the result object is one of the following:

XPOBJTYP_BOOL XPOBJTYP_NUM XPOBJTYP_STR XPOBJTYP_NSET XPOBJTYP_RTFRAG

The object type can be obtained using getxpobjtyp.