XPath methods process XPath related types and interfaces.
This chapter contains this section:
Table 13-1 summarizes the methods available through the XPath interface.
Table 13-1 Summary of XPath Methods
| Function | Summary | 
|---|---|
| 
 Create an XPath context.  | 
|
| 
 Destroy an XPath context.  | 
|
| 
 Evaluate XPath expression.  | 
|
| 
 Get boolean value of XPath object.  | 
|
| 
 Get fragment value of XPath object.  | 
|
| 
 Get node from nodeset type XPath object.  | 
|
| 
 Get number of nodes in nodeset type XPath object.  | 
|
| 
 Get number from XPath object.  | 
|
| 
 Get string from XPath object.  | 
|
| 
 Get XPath object type.  | 
|
| 
 Parse XPath expression.  | 
Create an XPath context
xpctx* XmlXPathCreateCtx( xmlctx *xsl, oratext *baseuri, xmlnode *ctxnode, ub4 ctxpos, ub4 ctxsize);
| Parameter | In/Out | Description | 
|---|---|---|
xsl  | 
IN  | 
XSL stylesheet as xmldoc object | 
baseuri  | 
IN  | 
base URI used by document, if any | 
ctxnode  | 
IN  | 
current context position | 
ctxpos  | 
IN  | 
current context size | 
ctxsize  | 
IN  | 
current context node | 
(xpctx *) XPath context or NULL on error
Destroy an XPath context.
void XmlXPathDestroyCtx( xpctx *xslxpctx);
| Parameter | In/Out | Description | 
|---|---|---|
xslxpctx  | 
IN  | 
XPath context object | 
Evaluate XPath expression.
xpobj *XmlXPathEval( xpctx *xctx, xpexpr *exprtree, xmlerr *err);
| Parameter | In/Out | Description | 
|---|---|---|
xctx  | 
IN  | 
XPath context | 
exprtree  | 
IN  | 
parsed XPath expression tree | 
err  | 
OUT  | 
error code | 
(xpobj *) result XPath object or NULL on error
Get boolean value of XPath object
boolean XmlXPathGetObjectBoolean( xpobj *obj);
| Parameter | In/Out | Description | 
|---|---|---|
obj  | 
IN  | 
XPath object | 
(boolean) truth value
Get boolean value of XPath object
xmlnode* XmlXPathGetObjectFragment( xpobj *obj);
| Parameter | In/Out | Description | 
|---|---|---|
obj  | 
IN  | 
XPath object | 
(boolean) truth value
Get node from nodeset-type XPath object
xmlnode *XmlXPathGetObjectNSetNode( xpobj *obj, ub4 i);
| Parameter | In/Out | Description | 
|---|---|---|
obj  | 
IN  | 
XPath object | 
i  | 
IN  | 
node index in nodeset | 
(xmlnode *) The object type or values.
Get number of nodes in nodeset-type XPath object
ub4 XmlXPathGetObjectNSetNum( xpobj *obj);
| Parameter | In/Out | Description | 
|---|---|---|
obj  | 
IN  | 
XPath object | 
(ub4) number of nodes in nodeset
Get number from XPath object
double XmlXPathGetObjectNumber( xpobj *obj);
| Parameter | In/Out | Description | 
|---|---|---|
obj  | 
IN  | 
XPath object | 
(double) number
Get string from XPath object
oratext *XmlXPathGetObjectString( xpobj *obj);
| Parameter | In/Out | Description | 
|---|---|---|
obj  | 
IN  | 
XPath object | 
(oratext *) string