Database XML C API Reference
ContentsOpens a new window
Opens a new window
Page 17 of 22

13 Package XPath APIs for C

XPath methods process XPath related types and interfaces.

This chapter contains this section:


XPath Interface

Table 13-1Opens a new window summarizes the methods available through the XPath interface.

Table 13-1 Summary of XPath Methods

Function Summary

XmlXPathCreateCtx()Opens a new window

Create an XPath context.

XmlXPathDestroyCtx()Opens a new window

Destroy an XPath context.

XmlXPathEval()Opens a new window

Evaluate XPath expression.

XmlXPathGetObjectBoolean()Opens a new window

Get boolean value of XPath object.

XmlXPathGetObjectFragment()Opens a new window

Get fragment value of XPath object.

XmlXPathGetObjectNSetNode()Opens a new window

Get node from nodeset type XPath object.

XmlXPathGetObjectNSetNum()Opens a new window

Get number of nodes in nodeset type XPath object.

XmlXPathGetObjectNumber()Opens a new window

Get number from XPath object.

XmlXPathGetObjectString()Opens a new window

Get string from XPath object.

XmlXPathGetObjectType()Opens a new window

Get XPath object type.

XmlXPathParse()Opens a new window

Parse XPath expression.



XmlXPathCreateCtx()

Create an XPath context

Syntax

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

Returns

(xpctx *) XPath context or NULL on error


XmlXPathDestroyCtx()

Destroy an XPath context.

Syntax

void XmlXPathDestroyCtx(
   xpctx *xslxpctx);
Parameter In/Out Description
xslxpctx
IN
XPath context object


XmlXPathEval()

Evaluate XPath expression.

Syntax

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

Returns

(xpobj *) result XPath object or NULL on error


XmlXPathGetObjectBoolean()

Get boolean value of XPath object

Syntax

boolean XmlXPathGetObjectBoolean(
   xpobj *obj);
Parameter In/Out Description
obj
IN
XPath object

Returns

(boolean) truth value


XmlXPathGetObjectFragment()

Get boolean value of XPath object

Syntax

xmlnode* XmlXPathGetObjectFragment(
   xpobj *obj);
Parameter In/Out Description
obj
IN
XPath object

Returns

(boolean) truth value


XmlXPathGetObjectNSetNode()

Get node from nodeset-type XPath object

Syntax

xmlnode *XmlXPathGetObjectNSetNode(
   xpobj *obj,
   ub4 i);
Parameter In/Out Description
obj
IN
XPath object
i
IN
node index in nodeset

Returns

(xmlnode *) The object type or values.


XmlXPathGetObjectNSetNum()

Get number of nodes in nodeset-type XPath object

Syntax

ub4 XmlXPathGetObjectNSetNum(
   xpobj *obj);
Parameter In/Out Description
obj
IN
XPath object

Returns

(ub4) number of nodes in nodeset


XmlXPathGetObjectNumber()

Get number from XPath object

Syntax

double XmlXPathGetObjectNumber(
   xpobj *obj);
Parameter In/Out Description
obj
IN
XPath object

Returns

(double) number


XmlXPathGetObjectString()

Get string from XPath object

Syntax

oratext *XmlXPathGetObjectString(
   xpobj *obj);
Parameter In/Out Description
obj
IN
XPath object

Returns

(oratext *) string


XmlXPathGetObjectType()

Get XPath object type

Syntax

xmlxslobjtype XmlXPathGetObjectType(
   xpobj *obj);
Parameter In/Out Description
obj
IN
XPath object

Returns

(xmlxslobjtype) type-code for object


XmlXPathParse()

Parse XPath expression.

Syntax

xpexpr* XmlXPathParse(
   xpctx *xctx,
   oratext *expr,
   xmlerr * err);
Parameter In/Out Description
xctx
IN
XPath context object
expr
IN
XPath expression
err
OUT
error code

Returns

(xpexpr *) XPath expression parse tree or NULL on error