1<?xml version="1.0" encoding="UTF-8"?> 2<html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 5 <title>xpath: XML Path Language implementation</title> 6 <meta name="generator" content="Libxml2 devhelp stylesheet"/> 7 <link rel="start" href="index.html" title="libxml2 Reference Manual"/> 8 <link rel="up" href="general.html" title="API"/> 9 <link rel="stylesheet" href="style.css" type="text/css"/> 10 <link rel="chapter" href="general.html" title="API"/> 11 </head> 12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13 <table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> 14 <tr valign="middle"> 15 <td> 16 <a accesskey="p" href="libxml2-xmlwriter.html"> 17 <img src="left.png" width="24" height="24" border="0" alt="Prev"/> 18 </a> 19 </td> 20 <td> 21 <a accesskey="u" href="general.html"> 22 <img src="up.png" width="24" height="24" border="0" alt="Up"/> 23 </a> 24 </td> 25 <td> 26 <a accesskey="h" href="index.html"> 27 <img src="home.png" width="24" height="24" border="0" alt="Home"/> 28 </a> 29 </td> 30 <td> 31 <a accesskey="n" href="libxml2-xpathInternals.html"> 32 <img src="right.png" width="24" height="24" border="0" alt="Next"/> 33 </a> 34 </td> 35 <th width="100%" align="center">libxml2 Reference Manual</th> 36 </tr> 37 </table> 38 <h2> 39 <span class="refentrytitle">xpath</span> 40 </h2> 41 <p>xpath - XML Path Language implementation</p> 42 <p>API for the XML Path Language implementation XML Path Language implementation XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer</p> 43 <p>Author(s): Daniel Veillard </p> 44 <div class="refsynopsisdiv"> 45 <h2>Synopsis</h2> 46 <pre class="synopsis">#define <a href="#xmlXPathNodeSetGetLength">xmlXPathNodeSetGetLength</a>(ns); 47#define <a href="#XML_XPATH_CHECKNS">XML_XPATH_CHECKNS</a>; 48#define <a href="#XML_XPATH_NOVAR">XML_XPATH_NOVAR</a>; 49#define <a href="#xmlXPathNodeSetItem">xmlXPathNodeSetItem</a>(ns, index); 50#define <a href="#xmlXPathNodeSetIsEmpty">xmlXPathNodeSetIsEmpty</a>(ns); 51typedef enum <a href="#xmlXPathObjectType">xmlXPathObjectType</a>; 52typedef <a href="libxml2-xpath.html#xmlXPathVariable">xmlXPathVariable</a> * <a href="#xmlXPathVariablePtr">xmlXPathVariablePtr</a>; 53typedef struct _xmlXPathContext <a href="#xmlXPathContext">xmlXPathContext</a>; 54typedef enum <a href="#xmlXPathError">xmlXPathError</a>; 55typedef struct _xmlXPathFunct <a href="#xmlXPathFunct">xmlXPathFunct</a>; 56typedef <a href="libxml2-xpath.html#xmlXPathType">xmlXPathType</a> * <a href="#xmlXPathTypePtr">xmlXPathTypePtr</a>; 57typedef struct _xmlXPathType <a href="#xmlXPathType">xmlXPathType</a>; 58typedef <a href="libxml2-xpath.html#xmlNodeSet">xmlNodeSet</a> * <a href="#xmlNodeSetPtr">xmlNodeSetPtr</a>; 59typedef <a href="libxml2-xpath.html#xmlXPathFunct">xmlXPathFunct</a> * <a href="#xmlXPathFuncPtr">xmlXPathFuncPtr</a>; 60typedef <a href="libxml2-xpath.html#xmlXPathCompExpr">xmlXPathCompExpr</a> * <a href="#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a>; 61typedef struct _xmlXPathObject <a href="#xmlXPathObject">xmlXPathObject</a>; 62typedef struct _xmlXPathCompExpr <a href="#xmlXPathCompExpr">xmlXPathCompExpr</a>; 63typedef <a href="libxml2-xpath.html#xmlXPathContext">xmlXPathContext</a> * <a href="#xmlXPathContextPtr">xmlXPathContextPtr</a>; 64typedef <a href="libxml2-xpath.html#xmlXPathParserContext">xmlXPathParserContext</a> * <a href="#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a>; 65typedef struct _xmlNodeSet <a href="#xmlNodeSet">xmlNodeSet</a>; 66typedef struct _xmlXPathVariable <a href="#xmlXPathVariable">xmlXPathVariable</a>; 67typedef <a href="libxml2-xpath.html#xmlXPathObject">xmlXPathObject</a> * <a href="#xmlXPathObjectPtr">xmlXPathObjectPtr</a>; 68typedef struct _xmlXPathAxis <a href="#xmlXPathAxis">xmlXPathAxis</a>; 69typedef <a href="libxml2-xpath.html#xmlXPathAxis">xmlXPathAxis</a> * <a href="#xmlXPathAxisPtr">xmlXPathAxisPtr</a>; 70typedef struct _xmlXPathParserContext <a href="#xmlXPathParserContext">xmlXPathParserContext</a>; 71int <a href="#xmlXPathCastNodeSetToBoolean">xmlXPathCastNodeSetToBoolean</a> (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> ns); 72typedef <a href="libxml2-xpath.html#xmlXPathFunction">xmlXPathFunction</a> <a href="#xmlXPathFuncLookupFunc">xmlXPathFuncLookupFunc</a> (void * ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ns_uri); 73<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathNodeEval">xmlXPathNodeEval</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx); 74<a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlXPathCastNodeToString">xmlXPathCastNodeToString</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node); 75int <a href="#xmlXPathIsNaN">xmlXPathIsNaN</a> (double val); 76int <a href="#xmlXPathContextSetCache">xmlXPathContextSetCache</a> (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br/> int active, <br/> int value, <br/> int options); 77<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathConvertString">xmlXPathConvertString</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val); 78int <a href="#xmlXPathCompiledEvalToBoolean">xmlXPathCompiledEvalToBoolean</a> (<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> comp, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt); 79int <a href="#xmlXPathIsInf">xmlXPathIsInf</a> (double val); 80long <a href="#xmlXPathOrderDocElems">xmlXPathOrderDocElems</a> (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc); 81<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> <a href="#xmlXPathNodeSetCreate">xmlXPathNodeSetCreate</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> val); 82double <a href="#xmlXPathCastBooleanToNumber">xmlXPathCastBooleanToNumber</a> (int val); 83double <a href="#xmlXPathCastNodeToNumber">xmlXPathCastNodeToNumber</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node); 84double <a href="#xmlXPathCastStringToNumber">xmlXPathCastStringToNumber</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * val); 85typedef <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathAxisFunc">xmlXPathAxisFunc</a> (<a href="libxml2-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a> ctxt, <br/> <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> cur); 86double <a href="#xmlXPathCastToNumber">xmlXPathCastToNumber</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val); 87int <a href="#xmlXPathCastStringToBoolean">xmlXPathCastStringToBoolean</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * val); 88<a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlXPathCastNumberToString">xmlXPathCastNumberToString</a> (double val); 89typedef <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathVariableLookupFunc">xmlXPathVariableLookupFunc</a> (void * ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ns_uri); 90void <a href="#xmlXPathFreeObject">xmlXPathFreeObject</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> obj); 91int <a href="#xmlXPathEvalPredicate">xmlXPathEvalPredicate</a> (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br/> <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> res); 92void <a href="#xmlXPathFreeContext">xmlXPathFreeContext</a> (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt); 93<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathObjectCopy">xmlXPathObjectCopy</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val); 94void <a href="#xmlXPathFreeNodeSetList">xmlXPathFreeNodeSetList</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> obj); 95<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathEval">xmlXPathEval</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx); 96<a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlXPathCastNodeSetToString">xmlXPathCastNodeSetToString</a> (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> ns); 97<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathCompiledEval">xmlXPathCompiledEval</a> (<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> comp, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx); 98<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathEvalExpression">xmlXPathEvalExpression</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt); 99void <a href="#xmlXPathInit">xmlXPathInit</a> (void); 100<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathConvertBoolean">xmlXPathConvertBoolean</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val); 101typedef int <a href="#xmlXPathConvertFunc">xmlXPathConvertFunc</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> obj, <br/> int type); 102typedef void <a href="#xmlXPathFunction">xmlXPathFunction</a> (<a href="libxml2-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a> ctxt, <br/> int nargs); 103int <a href="#xmlXPathCmpNodes">xmlXPathCmpNodes</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node1, <br/> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node2); 104<a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlXPathCastToString">xmlXPathCastToString</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val); 105<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> <a href="#xmlXPathCtxtCompile">xmlXPathCtxtCompile</a> (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str); 106typedef void <a href="#xmlXPathEvalFunc">xmlXPathEvalFunc</a> (<a href="libxml2-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a> ctxt, <br/> int nargs); 107<a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlXPathCastBooleanToString">xmlXPathCastBooleanToString</a> (int val); 108int <a href="#xmlXPathSetContextNode">xmlXPathSetContextNode</a> (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx); 109int <a href="#xmlXPathCastNumberToBoolean">xmlXPathCastNumberToBoolean</a> (double val); 110void <a href="#xmlXPathFreeNodeSet">xmlXPathFreeNodeSet</a> (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> obj); 111void <a href="#xmlXPathFreeCompExpr">xmlXPathFreeCompExpr</a> (<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> comp); 112<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> <a href="#xmlXPathNewContext">xmlXPathNewContext</a> (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc); 113<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> <a href="#xmlXPathConvertNumber">xmlXPathConvertNumber</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val); 114<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> <a href="#xmlXPathCompile">xmlXPathCompile</a> (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str); 115double <a href="#xmlXPathCastNodeSetToNumber">xmlXPathCastNodeSetToNumber</a> (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> ns); 116int <a href="#xmlXPathCastToBoolean">xmlXPathCastToBoolean</a> (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val); 117</pre> 118 </div> 119 <div class="refsect1" lang="en"> 120 <h2>Description</h2> 121 </div> 122 <div class="refsect1" lang="en"> 123 <h2>Details</h2> 124 <div class="refsect2" lang="en"> 125 <div class="refsect2" lang="en"><h3><a name="XML_XPATH_CHECKNS">Macro </a>XML_XPATH_CHECKNS</h3><pre class="programlisting">#define <a href="#XML_XPATH_CHECKNS">XML_XPATH_CHECKNS</a>; 126</pre><p>check namespaces at compilation</p> 127</div> 128 <hr/> 129 <div class="refsect2" lang="en"><h3><a name="XML_XPATH_NOVAR">Macro </a>XML_XPATH_NOVAR</h3><pre class="programlisting">#define <a href="#XML_XPATH_NOVAR">XML_XPATH_NOVAR</a>; 130</pre><p>forbid variables in expression</p> 131</div> 132 <hr/> 133 <div class="refsect2" lang="en"><h3><a name="xmlXPathNodeSetGetLength">Macro </a>xmlXPathNodeSetGetLength</h3><pre class="programlisting">#define <a href="#xmlXPathNodeSetGetLength">xmlXPathNodeSetGetLength</a>(ns); 134</pre><p>Implement a functionality similar to the DOM NodeList.length. Returns the number of nodes in the node-set.</p><div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>a node-set</td></tr></tbody></table></div> 135</div> 136 <hr/> 137 <div class="refsect2" lang="en"><h3><a name="xmlXPathNodeSetIsEmpty">Macro </a>xmlXPathNodeSetIsEmpty</h3><pre class="programlisting">#define <a href="#xmlXPathNodeSetIsEmpty">xmlXPathNodeSetIsEmpty</a>(ns); 138</pre><p>Checks whether @ns is empty or not. Returns %TRUE if @ns is an empty node-set.</p><div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>a node-set</td></tr></tbody></table></div> 139</div> 140 <hr/> 141 <div class="refsect2" lang="en"><h3><a name="xmlXPathNodeSetItem">Macro </a>xmlXPathNodeSetItem</h3><pre class="programlisting">#define <a href="#xmlXPathNodeSetItem">xmlXPathNodeSetItem</a>(ns, index); 142</pre><p>Implements a functionality similar to the DOM NodeList.item(). Returns the <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> at the given @index in @ns or NULL if @index is out of range (0 to length-1)</p><div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>a node-set</td></tr><tr><td><span class="term"><i><tt>index</tt></i>:</span></td><td>index of a node in the set</td></tr></tbody></table></div> 143</div> 144 <hr/> 145 <div class="refsect2" lang="en"><h3><a name="xmlNodeSet">Structure </a>xmlNodeSet</h3><pre class="programlisting">struct _xmlNodeSet { 146 int nodeNr : number of nodes in the set 147 int nodeMax : size of the array as allocated 148 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> * nodeTab : array of nodes in no particular order @@ with_ns to check wether name 149} xmlNodeSet; 150</pre><p/> 151</div> 152 <hr/> 153 <div class="refsect2" lang="en"><h3><a name="xmlNodeSetPtr">Typedef </a>xmlNodeSetPtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlNodeSet">xmlNodeSet</a> * xmlNodeSetPtr; 154</pre><p/> 155</div> 156 <hr/> 157 <div class="refsect2" lang="en"><h3><a name="xmlXPathAxis">Structure </a>xmlXPathAxis</h3><pre class="programlisting">struct _xmlXPathAxis { 158 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name : the axis name 159 <a href="libxml2-xpath.html#xmlXPathAxisFunc">xmlXPathAxisFunc</a> func : the search function 160} xmlXPathAxis; 161</pre><p/> 162</div> 163 <hr/> 164 <div class="refsect2" lang="en"><h3><a name="xmlXPathAxisPtr">Typedef </a>xmlXPathAxisPtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathAxis">xmlXPathAxis</a> * xmlXPathAxisPtr; 165</pre><p/> 166</div> 167 <hr/> 168 <div class="refsect2" lang="en"><h3><a name="xmlXPathCompExpr">Structure </a>xmlXPathCompExpr</h3><pre class="programlisting">struct _xmlXPathCompExpr { 169The content of this structure is not made public by the API. 170} xmlXPathCompExpr; 171</pre><p/> 172</div> 173 <hr/> 174 <div class="refsect2" lang="en"><h3><a name="xmlXPathCompExprPtr">Typedef </a>xmlXPathCompExprPtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathCompExpr">xmlXPathCompExpr</a> * xmlXPathCompExprPtr; 175</pre><p/> 176</div> 177 <hr/> 178 <div class="refsect2" lang="en"><h3><a name="xmlXPathContext">Structure </a>xmlXPathContext</h3><pre class="programlisting">struct _xmlXPathContext { 179 <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc : The current document 180 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node : The current node 181 int nb_variables_unused : unused (hash table) 182 int max_variables_unused : unused (hash table) 183 <a href="libxml2-hash.html#xmlHashTablePtr">xmlHashTablePtr</a> varHash : Hash table of defined variables 184 int nb_types : number of defined types 185 int max_types : max number of types 186 <a href="libxml2-xpath.html#xmlXPathTypePtr">xmlXPathTypePtr</a> types : Array of defined types 187 int nb_funcs_unused : unused (hash table) 188 int max_funcs_unused : unused (hash table) 189 <a href="libxml2-hash.html#xmlHashTablePtr">xmlHashTablePtr</a> funcHash : Hash table of defined funcs 190 int nb_axis : number of defined axis 191 int max_axis : max number of axis 192 <a href="libxml2-xpath.html#xmlXPathAxisPtr">xmlXPathAxisPtr</a> axis : Array of defined axis the namespace nodes of the context node 193 <a href="libxml2-tree.html#xmlNsPtr">xmlNsPtr</a> * namespaces : Array of namespaces 194 int nsNr : number of namespace in scope 195 void * user : function to free extra variables 196 int contextSize : the context size 197 int proximityPosition : the proximity position extra stuff for XPointer 198 int xptr : is this an XPointer context? 199 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> here : for here() 200 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> origin : for origin() the set of namespace declarations in scope for the expre 201 <a href="libxml2-hash.html#xmlHashTablePtr">xmlHashTablePtr</a> nsHash : The namespaces hash table 202 <a href="libxml2-xpath.html#xmlXPathVariableLookupFunc">xmlXPathVariableLookupFunc</a> varLookupFunc : variable lookup func 203 void * varLookupData : variable lookup data Possibility to link in an extra item 204 void * extra : needed for XSLT The function name and URI when calling a function 205 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * function 206 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * functionURI : function lookup function and data 207 <a href="libxml2-xpath.html#xmlXPathFuncLookupFunc">xmlXPathFuncLookupFunc</a> funcLookupFunc : function lookup func 208 void * funcLookupData : function lookup data temporary namespace lists kept for walking the n 209 <a href="libxml2-tree.html#xmlNsPtr">xmlNsPtr</a> * tmpNsList : Array of namespaces 210 int tmpNsNr : number of namespaces in scope error reporting mechanism 211 void * userData : user specific data block 212 <a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> error : the callback in case of errors 213 <a href="libxml2-xmlerror.html#xmlError">xmlError</a> lastError : the last error 214 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> debugNode : the source node XSLT dictionary 215 <a href="libxml2-dict.html#xmlDictPtr">xmlDictPtr</a> dict : dictionary if any 216 int flags : flags to control compilation Cache for reusal of XPath objects 217 void * cache 218} xmlXPathContext; 219</pre><p/> 220</div> 221 <hr/> 222 <div class="refsect2" lang="en"><h3><a name="xmlXPathContextPtr">Typedef </a>xmlXPathContextPtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathContext">xmlXPathContext</a> * xmlXPathContextPtr; 223</pre><p/> 224</div> 225 <hr/> 226 <div class="refsect2" lang="en"><h3><a name="xmlXPathError">Enum </a>xmlXPathError</h3><pre class="programlisting">enum <a href="#xmlXPathError">xmlXPathError</a> { 227 <a name="XPATH_EXPRESSION_OK">XPATH_EXPRESSION_OK</a> = 0 228 <a name="XPATH_NUMBER_ERROR">XPATH_NUMBER_ERROR</a> = 1 229 <a name="XPATH_UNFINISHED_LITERAL_ERROR">XPATH_UNFINISHED_LITERAL_ERROR</a> = 2 230 <a name="XPATH_START_LITERAL_ERROR">XPATH_START_LITERAL_ERROR</a> = 3 231 <a name="XPATH_VARIABLE_REF_ERROR">XPATH_VARIABLE_REF_ERROR</a> = 4 232 <a name="XPATH_UNDEF_VARIABLE_ERROR">XPATH_UNDEF_VARIABLE_ERROR</a> = 5 233 <a name="XPATH_INVALID_PREDICATE_ERROR">XPATH_INVALID_PREDICATE_ERROR</a> = 6 234 <a name="XPATH_EXPR_ERROR">XPATH_EXPR_ERROR</a> = 7 235 <a name="XPATH_UNCLOSED_ERROR">XPATH_UNCLOSED_ERROR</a> = 8 236 <a name="XPATH_UNKNOWN_FUNC_ERROR">XPATH_UNKNOWN_FUNC_ERROR</a> = 9 237 <a name="XPATH_INVALID_OPERAND">XPATH_INVALID_OPERAND</a> = 10 238 <a name="XPATH_INVALID_TYPE">XPATH_INVALID_TYPE</a> = 11 239 <a name="XPATH_INVALID_ARITY">XPATH_INVALID_ARITY</a> = 12 240 <a name="XPATH_INVALID_CTXT_SIZE">XPATH_INVALID_CTXT_SIZE</a> = 13 241 <a name="XPATH_INVALID_CTXT_POSITION">XPATH_INVALID_CTXT_POSITION</a> = 14 242 <a name="XPATH_MEMORY_ERROR">XPATH_MEMORY_ERROR</a> = 15 243 <a name="XPTR_SYNTAX_ERROR">XPTR_SYNTAX_ERROR</a> = 16 244 <a name="XPTR_RESOURCE_ERROR">XPTR_RESOURCE_ERROR</a> = 17 245 <a name="XPTR_SUB_RESOURCE_ERROR">XPTR_SUB_RESOURCE_ERROR</a> = 18 246 <a name="XPATH_UNDEF_PREFIX_ERROR">XPATH_UNDEF_PREFIX_ERROR</a> = 19 247 <a name="XPATH_ENCODING_ERROR">XPATH_ENCODING_ERROR</a> = 20 248 <a name="XPATH_INVALID_CHAR_ERROR">XPATH_INVALID_CHAR_ERROR</a> = 21 249 <a name="XPATH_INVALID_CTXT">XPATH_INVALID_CTXT</a> = 22 250 <a name="XPATH_STACK_ERROR">XPATH_STACK_ERROR</a> = 23 251 <a name="XPATH_FORBID_VARIABLE_ERROR">XPATH_FORBID_VARIABLE_ERROR</a> = 24 252}; 253</pre><p/> 254</div> 255 <hr/> 256 <div class="refsect2" lang="en"><h3><a name="xmlXPathFuncPtr">Typedef </a>xmlXPathFuncPtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathFunct">xmlXPathFunct</a> * xmlXPathFuncPtr; 257</pre><p/> 258</div> 259 <hr/> 260 <div class="refsect2" lang="en"><h3><a name="xmlXPathFunct">Structure </a>xmlXPathFunct</h3><pre class="programlisting">struct _xmlXPathFunct { 261 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name : the function name 262 <a href="libxml2-xpath.html#xmlXPathEvalFunc">xmlXPathEvalFunc</a> func : the evaluation function 263} xmlXPathFunct; 264</pre><p/> 265</div> 266 <hr/> 267 <div class="refsect2" lang="en"><h3><a name="xmlXPathObject">Structure </a>xmlXPathObject</h3><pre class="programlisting">struct _xmlXPathObject { 268 <a href="libxml2-xpath.html#xmlXPathObjectType">xmlXPathObjectType</a> type 269 <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> nodesetval 270 int boolval 271 double floatval 272 <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * stringval 273 void * user 274 int index 275 void * user2 276 int index2 277} xmlXPathObject; 278</pre><p/> 279</div> 280 <hr/> 281 <div class="refsect2" lang="en"><h3><a name="xmlXPathObjectPtr">Typedef </a>xmlXPathObjectPtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObject">xmlXPathObject</a> * xmlXPathObjectPtr; 282</pre><p/> 283</div> 284 <hr/> 285 <div class="refsect2" lang="en"><h3><a name="xmlXPathObjectType">Enum </a>xmlXPathObjectType</h3><pre class="programlisting">enum <a href="#xmlXPathObjectType">xmlXPathObjectType</a> { 286 <a name="XPATH_UNDEFINED">XPATH_UNDEFINED</a> = 0 287 <a name="XPATH_NODESET">XPATH_NODESET</a> = 1 288 <a name="XPATH_BOOLEAN">XPATH_BOOLEAN</a> = 2 289 <a name="XPATH_NUMBER">XPATH_NUMBER</a> = 3 290 <a name="XPATH_STRING">XPATH_STRING</a> = 4 291 <a name="XPATH_POINT">XPATH_POINT</a> = 5 292 <a name="XPATH_RANGE">XPATH_RANGE</a> = 6 293 <a name="XPATH_LOCATIONSET">XPATH_LOCATIONSET</a> = 7 294 <a name="XPATH_USERS">XPATH_USERS</a> = 8 295 <a name="XPATH_XSLT_TREE">XPATH_XSLT_TREE</a> = 9 /* An XSLT value tree, non modifiable */ 296}; 297</pre><p/> 298</div> 299 <hr/> 300 <div class="refsect2" lang="en"><h3><a name="xmlXPathParserContext">Structure </a>xmlXPathParserContext</h3><pre class="programlisting">struct _xmlXPathParserContext { 301 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * cur : the current char being parsed 302 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * base : the full expression 303 int error : error code 304 <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> context : the evaluation context 305 <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> value : the current value 306 int valueNr : number of values stacked 307 int valueMax : max number of values stacked 308 <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> * valueTab : stack of values 309 <a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> comp : the precompiled expression 310 int xptr : it this an XPointer expression 311 <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> ancestor : used for walking preceding axis 312 int valueFrame : used to limit Pop on the stack 313} xmlXPathParserContext; 314</pre><p/> 315</div> 316 <hr/> 317 <div class="refsect2" lang="en"><h3><a name="xmlXPathParserContextPtr">Typedef </a>xmlXPathParserContextPtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathParserContext">xmlXPathParserContext</a> * xmlXPathParserContextPtr; 318</pre><p/> 319</div> 320 <hr/> 321 <div class="refsect2" lang="en"><h3><a name="xmlXPathType">Structure </a>xmlXPathType</h3><pre class="programlisting">struct _xmlXPathType { 322 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name : the type name 323 <a href="libxml2-xpath.html#xmlXPathConvertFunc">xmlXPathConvertFunc</a> func : the conversion function 324} xmlXPathType; 325</pre><p/> 326</div> 327 <hr/> 328 <div class="refsect2" lang="en"><h3><a name="xmlXPathTypePtr">Typedef </a>xmlXPathTypePtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathType">xmlXPathType</a> * xmlXPathTypePtr; 329</pre><p/> 330</div> 331 <hr/> 332 <div class="refsect2" lang="en"><h3><a name="xmlXPathVariable">Structure </a>xmlXPathVariable</h3><pre class="programlisting">struct _xmlXPathVariable { 333 const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name : the variable name 334 <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> value : the value 335} xmlXPathVariable; 336</pre><p/> 337</div> 338 <hr/> 339 <div class="refsect2" lang="en"><h3><a name="xmlXPathVariablePtr">Typedef </a>xmlXPathVariablePtr</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathVariable">xmlXPathVariable</a> * xmlXPathVariablePtr; 340</pre><p/> 341</div> 342 <hr/> 343 <div class="refsect2" lang="en"><h3><a name="xmlXPathAxisFunc"/>Function type xmlXPathAxisFunc</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathAxisFunc (<a href="libxml2-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a> ctxt, <br/> <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> cur)<br/> 344</pre><p>An axis traversal function. To traverse an axis, the engine calls the first time with cur == NULL and repeat until the function returns NULL indicating the end of the axis traversal.</p> 345<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XPath interpreter context</td></tr><tr><td><span class="term"><i><tt>cur</tt></i>:</span></td><td>the previous node being explored on that axis</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the next node in that axis or NULL if at the end of the axis.</td></tr></tbody></table></div></div> 346 <hr/> 347 <div class="refsect2" lang="en"><h3><a name="xmlXPathConvertFunc"/>Function type xmlXPathConvertFunc</h3><pre class="programlisting">int xmlXPathConvertFunc (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> obj, <br/> int type)<br/> 348</pre><p>A conversion function is associated to a type and used to cast the new type to primitive values.</p> 349<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>obj</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>the number of the target type</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 otherwise</td></tr></tbody></table></div></div> 350 <hr/> 351 <div class="refsect2" lang="en"><h3><a name="xmlXPathEvalFunc"/>Function type xmlXPathEvalFunc</h3><pre class="programlisting">void xmlXPathEvalFunc (<a href="libxml2-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a> ctxt, <br/> int nargs)<br/> 352</pre><p>An XPath evaluation function, the parameters are on the XPath context stack.</p> 353<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XPath parser context</td></tr><tr><td><span class="term"><i><tt>nargs</tt></i>:</span></td><td>the number of arguments passed to the function</td></tr></tbody></table></div></div> 354 <hr/> 355 <div class="refsect2" lang="en"><h3><a name="xmlXPathFuncLookupFunc"/>Function type xmlXPathFuncLookupFunc</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathFunction">xmlXPathFunction</a> xmlXPathFuncLookupFunc (void * ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ns_uri)<br/> 356</pre><p>Prototype for callbacks used to plug function lookup in the XPath engine.</p> 357<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XPath context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>name of the function</td></tr><tr><td><span class="term"><i><tt>ns_uri</tt></i>:</span></td><td>the namespace name hosting this function</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XPath function or NULL if not found.</td></tr></tbody></table></div></div> 358 <hr/> 359 <div class="refsect2" lang="en"><h3><a name="xmlXPathFunction"/>Function type xmlXPathFunction</h3><pre class="programlisting">void xmlXPathFunction (<a href="libxml2-xpath.html#xmlXPathParserContextPtr">xmlXPathParserContextPtr</a> ctxt, <br/> int nargs)<br/> 360</pre><p>An XPath function. The arguments (if any) are popped out from the context stack and the result is pushed on the stack.</p> 361<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XPath interprestation context</td></tr><tr><td><span class="term"><i><tt>nargs</tt></i>:</span></td><td>the number of arguments</td></tr></tbody></table></div></div> 362 <hr/> 363 <div class="refsect2" lang="en"><h3><a name="xmlXPathVariableLookupFunc"/>Function type xmlXPathVariableLookupFunc</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathVariableLookupFunc (void * ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * name, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * ns_uri)<br/> 364</pre><p>Prototype for callbacks used to plug variable lookup in the XPath engine.</p> 365<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XPath context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>name of the variable</td></tr><tr><td><span class="term"><i><tt>ns_uri</tt></i>:</span></td><td>the namespace name hosting this variable</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XPath object value or NULL if not found.</td></tr></tbody></table></div></div> 366 <hr/> 367 <div class="refsect2" lang="en"><h3><a name="xmlXPathNAN">Variable </a>xmlXPathNAN</h3><pre class="programlisting">double xmlXPathNAN; 368</pre><p/> 369</div> 370 <hr/> 371 <div class="refsect2" lang="en"><h3><a name="xmlXPathNINF">Variable </a>xmlXPathNINF</h3><pre class="programlisting">double xmlXPathNINF; 372</pre><p/> 373</div> 374 <hr/> 375 <div class="refsect2" lang="en"><h3><a name="xmlXPathPINF">Variable </a>xmlXPathPINF</h3><pre class="programlisting">double xmlXPathPINF; 376</pre><p/> 377</div> 378 <hr/> 379 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastBooleanToNumber"/>xmlXPathCastBooleanToNumber ()</h3><pre class="programlisting">double xmlXPathCastBooleanToNumber (int val)<br/> 380</pre><p>Converts a boolean to its number value</p> 381<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a boolean</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number value</td></tr></tbody></table></div></div> 382 <hr/> 383 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastBooleanToString"/>xmlXPathCastBooleanToString ()</h3><pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlXPathCastBooleanToString (int val)<br/> 384</pre><p>Converts a boolean to its string value.</p> 385<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a boolean</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a newly allocated string.</td></tr></tbody></table></div></div> 386 <hr/> 387 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastNodeSetToBoolean"/>xmlXPathCastNodeSetToBoolean ()</h3><pre class="programlisting">int xmlXPathCastNodeSetToBoolean (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> ns)<br/> 388</pre><p>Converts a node-set to its boolean value</p> 389<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>a node-set</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the boolean value</td></tr></tbody></table></div></div> 390 <hr/> 391 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastNodeSetToNumber"/>xmlXPathCastNodeSetToNumber ()</h3><pre class="programlisting">double xmlXPathCastNodeSetToNumber (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> ns)<br/> 392</pre><p>Converts a node-set to its number value</p> 393<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>a node-set</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number value</td></tr></tbody></table></div></div> 394 <hr/> 395 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastNodeSetToString"/>xmlXPathCastNodeSetToString ()</h3><pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlXPathCastNodeSetToString (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> ns)<br/> 396</pre><p>Converts a node-set to its string value.</p> 397<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>a node-set</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a newly allocated string.</td></tr></tbody></table></div></div> 398 <hr/> 399 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastNodeToNumber"/>xmlXPathCastNodeToNumber ()</h3><pre class="programlisting">double xmlXPathCastNodeToNumber (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node)<br/> 400</pre><p>Converts a node to its number value</p> 401<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>a node</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number value</td></tr></tbody></table></div></div> 402 <hr/> 403 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastNodeToString"/>xmlXPathCastNodeToString ()</h3><pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlXPathCastNodeToString (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node)<br/> 404</pre><p>Converts a node to its string value.</p> 405<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>a node</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a newly allocated string.</td></tr></tbody></table></div></div> 406 <hr/> 407 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastNumberToBoolean"/>xmlXPathCastNumberToBoolean ()</h3><pre class="programlisting">int xmlXPathCastNumberToBoolean (double val)<br/> 408</pre><p>Converts a number to its boolean value</p> 409<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a number</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the boolean value</td></tr></tbody></table></div></div> 410 <hr/> 411 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastNumberToString"/>xmlXPathCastNumberToString ()</h3><pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlXPathCastNumberToString (double val)<br/> 412</pre><p>Converts a number to its string value.</p> 413<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a number</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a newly allocated string.</td></tr></tbody></table></div></div> 414 <hr/> 415 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastStringToBoolean"/>xmlXPathCastStringToBoolean ()</h3><pre class="programlisting">int xmlXPathCastStringToBoolean (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * val)<br/> 416</pre><p>Converts a string to its boolean value</p> 417<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a string</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the boolean value</td></tr></tbody></table></div></div> 418 <hr/> 419 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastStringToNumber"/>xmlXPathCastStringToNumber ()</h3><pre class="programlisting">double xmlXPathCastStringToNumber (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * val)<br/> 420</pre><p>Converts a string to its number value</p> 421<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a string</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number value</td></tr></tbody></table></div></div> 422 <hr/> 423 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastToBoolean"/>xmlXPathCastToBoolean ()</h3><pre class="programlisting">int xmlXPathCastToBoolean (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br/> 424</pre><p>Converts an XPath object to its boolean value</p> 425<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the boolean value</td></tr></tbody></table></div></div> 426 <hr/> 427 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastToNumber"/>xmlXPathCastToNumber ()</h3><pre class="programlisting">double xmlXPathCastToNumber (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br/> 428</pre><p>Converts an XPath object to its number value</p> 429<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number value</td></tr></tbody></table></div></div> 430 <hr/> 431 <div class="refsect2" lang="en"><h3><a name="xmlXPathCastToString"/>xmlXPathCastToString ()</h3><pre class="programlisting"><a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * xmlXPathCastToString (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br/> 432</pre><p>Converts an existing object to its string() equivalent</p> 433<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the allocated string value of the object, NULL in case of error. It's up to the caller to free the string memory with xmlFree().</td></tr></tbody></table></div></div> 434 <hr/> 435 <div class="refsect2" lang="en"><h3><a name="xmlXPathCmpNodes"/>xmlXPathCmpNodes ()</h3><pre class="programlisting">int xmlXPathCmpNodes (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node1, <br/> <a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node2)<br/> 436</pre><p>Compare two nodes w.r.t document order</p> 437<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>node1</tt></i>:</span></td><td>the first node</td></tr><tr><td><span class="term"><i><tt>node2</tt></i>:</span></td><td>the second node</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-2 in case of error 1 if first point < second point, 0 if it's the same node, -1 otherwise</td></tr></tbody></table></div></div> 438 <hr/> 439 <div class="refsect2" lang="en"><h3><a name="xmlXPathCompile"/>xmlXPathCompile ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> xmlXPathCompile (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str)<br/> 440</pre><p>Compile an XPath expression</p> 441<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the XPath expression</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> resulting from the compilation or NULL. the caller has to free the object.</td></tr></tbody></table></div></div> 442 <hr/> 443 <div class="refsect2" lang="en"><h3><a name="xmlXPathCompiledEval"/>xmlXPathCompiledEval ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathCompiledEval (<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> comp, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br/> 444</pre><p>Evaluate the Precompiled XPath expression in the given context.</p> 445<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the compiled XPath expression</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> resulting from the evaluation or NULL. the caller has to free the object.</td></tr></tbody></table></div></div> 446 <hr/> 447 <div class="refsect2" lang="en"><h3><a name="xmlXPathCompiledEvalToBoolean"/>xmlXPathCompiledEvalToBoolean ()</h3><pre class="programlisting">int xmlXPathCompiledEvalToBoolean (<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> comp, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt)<br/> 448</pre><p>Applies the XPath boolean() function on the result of the given compiled expression.</p> 449<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the compiled XPath expression</td></tr><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the expression evaluated to true, 0 if to false and -1 in API and internal errors.</td></tr></tbody></table></div></div> 450 <hr/> 451 <div class="refsect2" lang="en"><h3><a name="xmlXPathContextSetCache"/>xmlXPathContextSetCache ()</h3><pre class="programlisting">int xmlXPathContextSetCache (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br/> int active, <br/> int value, <br/> int options)<br/> 452</pre><p>Creates/frees an object cache on the XPath context. If activates XPath objects (xmlXPathObject) will be cached internally to be reused. @options: 0: This will set the XPath object caching: @value: This will set the maximum number of XPath objects to be cached per slot There are 5 slots for: node-set, string, number, boolean, and misc objects. Use <0 for the default number (100). Other values for @options have currently no effect.</p> 453<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>active</tt></i>:</span></td><td>enables/disables (creates/frees) the cache</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>a value with semantics dependant on @options</td></tr><tr><td><span class="term"><i><tt>options</tt></i>:</span></td><td>options (currently only the value 0 is used)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the setting succeeded, and -1 on API or internal errors.</td></tr></tbody></table></div></div> 454 <hr/> 455 <div class="refsect2" lang="en"><h3><a name="xmlXPathConvertBoolean"/>xmlXPathConvertBoolean ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathConvertBoolean (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br/> 456</pre><p>Converts an existing object to its boolean() equivalent</p> 457<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new object, the old one is freed (or the operation is done directly on @val)</td></tr></tbody></table></div></div> 458 <hr/> 459 <div class="refsect2" lang="en"><h3><a name="xmlXPathConvertNumber"/>xmlXPathConvertNumber ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathConvertNumber (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br/> 460</pre><p>Converts an existing object to its number() equivalent</p> 461<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new object, the old one is freed (or the operation is done directly on @val)</td></tr></tbody></table></div></div> 462 <hr/> 463 <div class="refsect2" lang="en"><h3><a name="xmlXPathConvertString"/>xmlXPathConvertString ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathConvertString (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br/> 464</pre><p>Converts an existing object to its string() equivalent</p> 465<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an XPath object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new object, the old one is freed (or the operation is done directly on @val)</td></tr></tbody></table></div></div> 466 <hr/> 467 <div class="refsect2" lang="en"><h3><a name="xmlXPathCtxtCompile"/>xmlXPathCtxtCompile ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> xmlXPathCtxtCompile (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str)<br/> 468</pre><p>Compile an XPath expression</p> 469<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XPath context</td></tr><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the XPath expression</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> resulting from the compilation or NULL. the caller has to free the object.</td></tr></tbody></table></div></div> 470 <hr/> 471 <div class="refsect2" lang="en"><h3><a name="xmlXPathEval"/>xmlXPathEval ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathEval (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br/> 472</pre><p>Evaluate the XPath Location Path in the given context.</p> 473<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the XPath expression</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> resulting from the evaluation or NULL. the caller has to free the object.</td></tr></tbody></table></div></div> 474 <hr/> 475 <div class="refsect2" lang="en"><h3><a name="xmlXPathEvalExpression"/>xmlXPathEvalExpression ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathEvalExpression (const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt)<br/> 476</pre><p>Alias for xmlXPathEval().</p> 477<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the XPath expression</td></tr><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> resulting from the evaluation or NULL. the caller has to free the object.</td></tr></tbody></table></div></div> 478 <hr/> 479 <div class="refsect2" lang="en"><h3><a name="xmlXPathEvalPredicate"/>xmlXPathEvalPredicate ()</h3><pre class="programlisting">int xmlXPathEvalPredicate (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt, <br/> <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> res)<br/> 480</pre><p>Evaluate a predicate result for the current node. A PredicateExpr is evaluated by evaluating the Expr and converting the result to a boolean. If the result is a number, the result will be converted to true if the number is equal to the position of the context node in the context node list (as returned by the position function) and will be converted to false otherwise; if the result is not a number, then the result will be converted as if by a call to the boolean function.</p> 481<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>res</tt></i>:</span></td><td>the Predicate Expression evaluation result</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if predicate is true, 0 otherwise</td></tr></tbody></table></div></div> 482 <hr/> 483 <div class="refsect2" lang="en"><h3><a name="xmlXPathFreeCompExpr"/>xmlXPathFreeCompExpr ()</h3><pre class="programlisting">void xmlXPathFreeCompExpr (<a href="libxml2-xpath.html#xmlXPathCompExprPtr">xmlXPathCompExprPtr</a> comp)<br/> 484</pre><p>Free up the memory allocated by @comp</p> 485<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>an XPATH comp</td></tr></tbody></table></div></div> 486 <hr/> 487 <div class="refsect2" lang="en"><h3><a name="xmlXPathFreeContext"/>xmlXPathFreeContext ()</h3><pre class="programlisting">void xmlXPathFreeContext (<a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctxt)<br/> 488</pre><p>Free up an <a href="libxml2-xpath.html#xmlXPathContext">xmlXPathContext</a></p> 489<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the context to free</td></tr></tbody></table></div></div> 490 <hr/> 491 <div class="refsect2" lang="en"><h3><a name="xmlXPathFreeNodeSet"/>xmlXPathFreeNodeSet ()</h3><pre class="programlisting">void xmlXPathFreeNodeSet (<a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> obj)<br/> 492</pre><p>Free the NodeSet compound (not the actual nodes !).</p> 493<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>obj</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> to free</td></tr></tbody></table></div></div> 494 <hr/> 495 <div class="refsect2" lang="en"><h3><a name="xmlXPathFreeNodeSetList"/>xmlXPathFreeNodeSetList ()</h3><pre class="programlisting">void xmlXPathFreeNodeSetList (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> obj)<br/> 496</pre><p>Free up the <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> @obj but don't deallocate the objects in the list contrary to xmlXPathFreeObject().</p> 497<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>obj</tt></i>:</span></td><td>an existing NodeSetList object</td></tr></tbody></table></div></div> 498 <hr/> 499 <div class="refsect2" lang="en"><h3><a name="xmlXPathFreeObject"/>xmlXPathFreeObject ()</h3><pre class="programlisting">void xmlXPathFreeObject (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> obj)<br/> 500</pre><p>Free up an <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> object.</p> 501<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>obj</tt></i>:</span></td><td>the object to free</td></tr></tbody></table></div></div> 502 <hr/> 503 <div class="refsect2" lang="en"><h3><a name="xmlXPathInit"/>xmlXPathInit ()</h3><pre class="programlisting">void xmlXPathInit (void)<br/> 504</pre><p>Initialize the XPath environment Does nothing but must be kept as public function.</p> 505</div> 506 <hr/> 507 <div class="refsect2" lang="en"><h3><a name="xmlXPathIsInf"/>xmlXPathIsInf ()</h3><pre class="programlisting">int xmlXPathIsInf (double val)<br/> 508</pre><p/> 509<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a double value</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the value is +Infinite, -1 if -Infinite, 0 otherwise</td></tr></tbody></table></div></div> 510 <hr/> 511 <div class="refsect2" lang="en"><h3><a name="xmlXPathIsNaN"/>xmlXPathIsNaN ()</h3><pre class="programlisting">int xmlXPathIsNaN (double val)<br/> 512</pre><p/> 513<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>a double value</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the value is a NaN, 0 otherwise</td></tr></tbody></table></div></div> 514 <hr/> 515 <div class="refsect2" lang="en"><h3><a name="xmlXPathNewContext"/>xmlXPathNewContext ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> xmlXPathNewContext (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br/> 516</pre><p>Create a new <a href="libxml2-xpath.html#xmlXPathContext">xmlXPathContext</a></p> 517<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the XML document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathContext">xmlXPathContext</a> just allocated. The caller will need to free it.</td></tr></tbody></table></div></div> 518 <hr/> 519 <div class="refsect2" lang="en"><h3><a name="xmlXPathNodeEval"/>xmlXPathNodeEval ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathNodeEval (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br/> const <a href="libxml2-xmlstring.html#xmlChar">xmlChar</a> * str, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br/> 520</pre><p>Evaluate the XPath Location Path in the given context. The node 'node' is set as the context node. The context node is not restored.</p> 521<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the node to to use as the context node</td></tr><tr><td><span class="term"><i><tt>str</tt></i>:</span></td><td>the XPath expression</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> resulting from the evaluation or NULL. the caller has to free the object.</td></tr></tbody></table></div></div> 522 <hr/> 523 <div class="refsect2" lang="en"><h3><a name="xmlXPathNodeSetCreate"/>xmlXPathNodeSetCreate ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> xmlXPathNodeSetCreate (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> val)<br/> 524</pre><p>Create a new <a href="libxml2-xpath.html#xmlNodeSetPtr">xmlNodeSetPtr</a> of type double and of value @val</p> 525<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>an initial xmlNodePtr, or NULL</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created object.</td></tr></tbody></table></div></div> 526 <hr/> 527 <div class="refsect2" lang="en"><h3><a name="xmlXPathObjectCopy"/>xmlXPathObjectCopy ()</h3><pre class="programlisting"><a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> xmlXPathObjectCopy (<a href="libxml2-xpath.html#xmlXPathObjectPtr">xmlXPathObjectPtr</a> val)<br/> 528</pre><p>allocate a new copy of a given object</p> 529<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>val</tt></i>:</span></td><td>the original object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the newly created object.</td></tr></tbody></table></div></div> 530 <hr/> 531 <div class="refsect2" lang="en"><h3><a name="xmlXPathOrderDocElems"/>xmlXPathOrderDocElems ()</h3><pre class="programlisting">long xmlXPathOrderDocElems (<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br/> 532</pre><p>Call this routine to speed up XPath computation on static documents. This stamps all the element nodes with the document order Like for line information, the order is kept in the element->content field, the value stored is actually - the node number (starting at -1) to be able to differentiate from line numbers.</p> 533<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>an input document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements found in the document or -1 in case of error.</td></tr></tbody></table></div></div> 534 <hr/> 535 <div class="refsect2" lang="en"><h3><a name="xmlXPathSetContextNode"/>xmlXPathSetContextNode ()</h3><pre class="programlisting">int xmlXPathSetContextNode (<a href="libxml2-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br/> <a href="libxml2-xpath.html#xmlXPathContextPtr">xmlXPathContextPtr</a> ctx)<br/> 536</pre><p>Sets 'node' as the context node. The node must be in the same document as that associated with the context.</p> 537<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the node to to use as the context node</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the XPath context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error or 0 if successful</td></tr></tbody></table></div></div> 538 <hr/> 539 </div> 540 </div> 541 </body> 542</html> 543