13 Package XPath for XML C APIs
XPath methods process XPath related types and interfaces.
The following table summarizes the methods available through the XPath package for XML C APIs.
Table 13-1 Summary of XPath Methods for XML C Implementation
| 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. |
13.1 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 |
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
13.2 XmlXPathDestroyCtx()
Destroy an XPath context.
Syntax
void XmlXPathDestroyCtx( xpctx *xslxpctx);
| Parameter | In/Out | Description |
|---|---|---|
xslxpctx |
IN |
XPath context object |
13.3 XmlXPathEval()
Evaluate XPath expression.
Syntax
xpobj *XmlXPathEval( xpctx *xctx, xpexpr *exprtree, xmlerr *err);
| Parameter | In/Out | Description |
|---|---|---|
xctx |
IN |
|
exprtree |
IN |
parsed |
err |
OUT |
error code |
Returns
(xpobj *) result XPath object or NULL on error
13.4 XmlXPathGetObjectBoolean()
Get boolean value of XPath object
Syntax
boolean XmlXPathGetObjectBoolean( xpobj *obj);
| Parameter | In/Out | Description |
|---|---|---|
obj |
IN |
XPath object |
Returns
(boolean) truth value
13.5 XmlXPathGetObjectFragment()
Get boolean value of XPath object
Syntax
xmlnode* XmlXPathGetObjectFragment( xpobj *obj);
| Parameter | In/Out | Description |
|---|---|---|
obj |
IN |
|
Returns
(boolean) truth value
13.6 XmlXPathGetObjectNSetNode()
Get node from nodeset-type XPath object
Syntax
xmlnode *XmlXPathGetObjectNSetNode( xpobj *obj, ub4 i);
| Parameter | In/Out | Description |
|---|---|---|
obj |
IN |
|
i |
IN |
node index in nodeset |
Returns
(xmlnode *) The object type or values.
13.7 XmlXPathGetObjectNSetNum()
Get number of nodes in nodeset-type XPath object
Syntax
ub4 XmlXPathGetObjectNSetNum( xpobj *obj);
| Parameter | In/Out | Description |
|---|---|---|
obj |
IN |
|
Returns
(ub4) number of nodes in nodeset
13.8 XmlXPathGetObjectNumber()
Get number from XPath object
Syntax
double XmlXPathGetObjectNumber( xpobj *obj);
| Parameter | In/Out | Description |
|---|---|---|
obj |
IN |
|
Returns
(double) number
13.9 XmlXPathGetObjectString()
Get string from XPath object
Syntax
oratext *XmlXPathGetObjectString( xpobj *obj);
| Parameter | In/Out | Description |
|---|---|---|
obj |
IN |
XPath object |
Returns
(oratext *) string
13.10 XmlXPathGetObjectType()
Get XPath object type
Syntax
xmlxslobjtype XmlXPathGetObjectType( xpobj *obj);
| Parameter | In/Out | Description |
|---|---|---|
obj |
IN |
XPath object |
Returns
(xmlxslobjtype) type-code for object