Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * xpath.c: interface for XML Path Language implementation |
| 3 | * |
| 4 | * Reference: W3C Working Draft 5 July 1999 |
| 5 | * http://www.w3.org/Style/XSL/Group/1999/07/xpath-19990705.html |
| 6 | * |
| 7 | * See COPYRIGHT for the status of this software |
| 8 | * |
Daniel Veillard | c5d6434 | 2001-06-24 12:13:24 +0000 | [diff] [blame] | 9 | * Author: daniel@veillard.com |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #ifndef __XML_XPATH_H__ |
| 13 | #define __XML_XPATH_H__ |
| 14 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 15 | #include <libxml/xmlversion.h> |
Daniel Veillard | d96f6d3 | 2003-10-07 21:25:12 +0000 | [diff] [blame^] | 16 | #include <libxml/xmlerror.h> |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 17 | #include <libxml/tree.h> |
| 18 | #include <libxml/hash.h> |
| 19 | |
| 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
| 24 | typedef struct _xmlXPathContext xmlXPathContext; |
| 25 | typedef xmlXPathContext *xmlXPathContextPtr; |
| 26 | typedef struct _xmlXPathParserContext xmlXPathParserContext; |
| 27 | typedef xmlXPathParserContext *xmlXPathParserContextPtr; |
| 28 | |
| 29 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 30 | * The set of XPath error codes. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | typedef enum { |
| 34 | XPATH_EXPRESSION_OK = 0, |
| 35 | XPATH_NUMBER_ERROR, |
| 36 | XPATH_UNFINISHED_LITERAL_ERROR, |
| 37 | XPATH_START_LITERAL_ERROR, |
| 38 | XPATH_VARIABLE_REF_ERROR, |
| 39 | XPATH_UNDEF_VARIABLE_ERROR, |
| 40 | XPATH_INVALID_PREDICATE_ERROR, |
| 41 | XPATH_EXPR_ERROR, |
| 42 | XPATH_UNCLOSED_ERROR, |
| 43 | XPATH_UNKNOWN_FUNC_ERROR, |
| 44 | XPATH_INVALID_OPERAND, |
| 45 | XPATH_INVALID_TYPE, |
| 46 | XPATH_INVALID_ARITY, |
| 47 | XPATH_INVALID_CTXT_SIZE, |
| 48 | XPATH_INVALID_CTXT_POSITION, |
| 49 | XPATH_MEMORY_ERROR, |
| 50 | XPTR_SYNTAX_ERROR, |
| 51 | XPTR_RESOURCE_ERROR, |
| 52 | XPTR_SUB_RESOURCE_ERROR, |
Daniel Veillard | 61d80a2 | 2001-04-27 17:13:01 +0000 | [diff] [blame] | 53 | XPATH_UNDEF_PREFIX_ERROR, |
| 54 | XPATH_ENCODING_ERROR, |
| 55 | XPATH_INVALID_CHAR_ERROR |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 56 | } xmlXPathError; |
| 57 | |
| 58 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 59 | * A node-set (an unordered collection of nodes without duplicates). |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 60 | */ |
| 61 | typedef struct _xmlNodeSet xmlNodeSet; |
| 62 | typedef xmlNodeSet *xmlNodeSetPtr; |
| 63 | struct _xmlNodeSet { |
| 64 | int nodeNr; /* number of nodes in the set */ |
| 65 | int nodeMax; /* size of the array as allocated */ |
| 66 | xmlNodePtr *nodeTab; /* array of nodes in no particular order */ |
Daniel Veillard | 044fc6b | 2002-03-04 17:09:44 +0000 | [diff] [blame] | 67 | /* @@ with_ns to check wether namespace nodes should be looked at @@ */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | /* |
| 71 | * An expression is evaluated to yield an object, which |
| 72 | * has one of the following four basic types: |
| 73 | * - node-set |
| 74 | * - boolean |
| 75 | * - number |
| 76 | * - string |
| 77 | * |
| 78 | * @@ XPointer will add more types ! |
| 79 | */ |
| 80 | |
| 81 | typedef enum { |
| 82 | XPATH_UNDEFINED = 0, |
| 83 | XPATH_NODESET = 1, |
| 84 | XPATH_BOOLEAN = 2, |
| 85 | XPATH_NUMBER = 3, |
| 86 | XPATH_STRING = 4, |
| 87 | XPATH_POINT = 5, |
| 88 | XPATH_RANGE = 6, |
| 89 | XPATH_LOCATIONSET = 7, |
| 90 | XPATH_USERS = 8, |
| 91 | XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ |
| 92 | } xmlXPathObjectType; |
| 93 | |
| 94 | typedef struct _xmlXPathObject xmlXPathObject; |
| 95 | typedef xmlXPathObject *xmlXPathObjectPtr; |
| 96 | struct _xmlXPathObject { |
| 97 | xmlXPathObjectType type; |
| 98 | xmlNodeSetPtr nodesetval; |
| 99 | int boolval; |
| 100 | double floatval; |
| 101 | xmlChar *stringval; |
| 102 | void *user; |
| 103 | int index; |
| 104 | void *user2; |
| 105 | int index2; |
| 106 | }; |
| 107 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 108 | /** |
| 109 | * xmlXPathConvertFunc: |
| 110 | * @obj: an XPath object |
| 111 | * @type: the number of the target type |
| 112 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 113 | * A conversion function is associated to a type and used to cast |
| 114 | * the new type to primitive values. |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 115 | * |
| 116 | * Returns -1 in case of error, 0 otherwise |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 117 | */ |
| 118 | typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); |
| 119 | |
| 120 | /* |
| 121 | * Extra type: a name and a conversion function. |
| 122 | */ |
| 123 | |
| 124 | typedef struct _xmlXPathType xmlXPathType; |
| 125 | typedef xmlXPathType *xmlXPathTypePtr; |
| 126 | struct _xmlXPathType { |
| 127 | const xmlChar *name; /* the type name */ |
| 128 | xmlXPathConvertFunc func; /* the conversion function */ |
| 129 | }; |
| 130 | |
| 131 | /* |
| 132 | * Extra variable: a name and a value. |
| 133 | */ |
| 134 | |
| 135 | typedef struct _xmlXPathVariable xmlXPathVariable; |
| 136 | typedef xmlXPathVariable *xmlXPathVariablePtr; |
| 137 | struct _xmlXPathVariable { |
| 138 | const xmlChar *name; /* the variable name */ |
| 139 | xmlXPathObjectPtr value; /* the value */ |
| 140 | }; |
| 141 | |
Daniel Veillard | 5168dbf | 2001-07-07 00:18:23 +0000 | [diff] [blame] | 142 | /** |
| 143 | * xmlXPathEvalFunc: |
| 144 | * @ctxt: an XPath parser context |
| 145 | * @nargs: the number of arguments passed to the function |
| 146 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 147 | * An XPath evaluation function, the parameters are on the XPath context stack. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 148 | */ |
| 149 | |
Daniel Veillard | 5168dbf | 2001-07-07 00:18:23 +0000 | [diff] [blame] | 150 | typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, |
| 151 | int nargs); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 152 | |
| 153 | /* |
| 154 | * Extra function: a name and a evaluation function. |
| 155 | */ |
| 156 | |
| 157 | typedef struct _xmlXPathFunct xmlXPathFunct; |
| 158 | typedef xmlXPathFunct *xmlXPathFuncPtr; |
| 159 | struct _xmlXPathFunct { |
| 160 | const xmlChar *name; /* the function name */ |
| 161 | xmlXPathEvalFunc func; /* the evaluation function */ |
| 162 | }; |
| 163 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 164 | /** |
| 165 | * xmlXPathAxisFunc: |
| 166 | * @ctxt: the XPath interpreter context |
| 167 | * @cur: the previous node being explored on that axis |
| 168 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 169 | * An axis traversal function. To traverse an axis, the engine calls |
| 170 | * the first time with cur == NULL and repeat until the function returns |
| 171 | * NULL indicating the end of the axis traversal. |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 172 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 173 | * Returns the next node in that axis or NULL if at the end of the axis. |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 174 | */ |
| 175 | |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 176 | typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, |
| 177 | xmlXPathObjectPtr cur); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 178 | |
| 179 | /* |
| 180 | * Extra axis: a name and an axis function. |
| 181 | */ |
| 182 | |
| 183 | typedef struct _xmlXPathAxis xmlXPathAxis; |
| 184 | typedef xmlXPathAxis *xmlXPathAxisPtr; |
| 185 | struct _xmlXPathAxis { |
| 186 | const xmlChar *name; /* the axis name */ |
| 187 | xmlXPathAxisFunc func; /* the search function */ |
| 188 | }; |
| 189 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 190 | /** |
| 191 | * xmlXPathContext: |
| 192 | * |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 193 | * Expression evaluation occurs with respect to a context. |
| 194 | * he context consists of: |
| 195 | * - a node (the context node) |
| 196 | * - a node list (the context node list) |
| 197 | * - a set of variable bindings |
| 198 | * - a function library |
| 199 | * - the set of namespace declarations in scope for the expression |
| 200 | * Following the switch to hash tables, this need to be trimmed up at |
| 201 | * the next binary incompatible release. |
| 202 | */ |
| 203 | |
| 204 | struct _xmlXPathContext { |
| 205 | xmlDocPtr doc; /* The current document */ |
| 206 | xmlNodePtr node; /* The current node */ |
| 207 | |
| 208 | int nb_variables_unused; /* unused (hash table) */ |
| 209 | int max_variables_unused; /* unused (hash table) */ |
| 210 | xmlHashTablePtr varHash; /* Hash table of defined variables */ |
| 211 | |
| 212 | int nb_types; /* number of defined types */ |
| 213 | int max_types; /* max number of types */ |
| 214 | xmlXPathTypePtr types; /* Array of defined types */ |
| 215 | |
| 216 | int nb_funcs_unused; /* unused (hash table) */ |
| 217 | int max_funcs_unused; /* unused (hash table) */ |
| 218 | xmlHashTablePtr funcHash; /* Hash table of defined funcs */ |
| 219 | |
| 220 | int nb_axis; /* number of defined axis */ |
| 221 | int max_axis; /* max number of axis */ |
| 222 | xmlXPathAxisPtr axis; /* Array of defined axis */ |
| 223 | |
| 224 | /* the namespace nodes of the context node */ |
| 225 | xmlNsPtr *namespaces; /* Array of namespaces */ |
| 226 | int nsNr; /* number of namespace in scope */ |
| 227 | void *user; /* function to free */ |
| 228 | |
| 229 | /* extra variables */ |
| 230 | int contextSize; /* the context size */ |
| 231 | int proximityPosition; /* the proximity position */ |
| 232 | |
| 233 | /* extra stuff for XPointer */ |
| 234 | int xptr; /* it this an XPointer context */ |
| 235 | xmlNodePtr here; /* for here() */ |
| 236 | xmlNodePtr origin; /* for origin() */ |
| 237 | |
| 238 | /* the set of namespace declarations in scope for the expression */ |
| 239 | xmlHashTablePtr nsHash; /* The namespaces hash table */ |
| 240 | void *varLookupFunc; /* variable lookup func */ |
| 241 | void *varLookupData; /* variable lookup data */ |
| 242 | |
| 243 | /* Possibility to link in an extra item */ |
| 244 | void *extra; /* needed for XSLT */ |
Daniel Veillard | 42596ad | 2001-05-22 16:57:14 +0000 | [diff] [blame] | 245 | |
| 246 | /* The function name and URI when calling a function */ |
| 247 | const xmlChar *function; |
| 248 | const xmlChar *functionURI; |
Thomas Broyer | ba4ad32 | 2001-07-26 16:55:21 +0000 | [diff] [blame] | 249 | |
| 250 | /* function lookup function and data */ |
| 251 | void *funcLookupFunc; /* function lookup func */ |
| 252 | void *funcLookupData; /* function lookup data */ |
Daniel Veillard | 7d7e379 | 2001-07-30 13:42:13 +0000 | [diff] [blame] | 253 | |
| 254 | /* temporary namespace lists kept for walking the namespace axis */ |
| 255 | xmlNsPtr *tmpNsList; /* Array of namespaces */ |
| 256 | int tmpNsNr; /* number of namespace in scope */ |
Daniel Veillard | d96f6d3 | 2003-10-07 21:25:12 +0000 | [diff] [blame^] | 257 | |
| 258 | /* error reporting mechanism */ |
| 259 | void *userData; /* user specific data block */ |
| 260 | xmlStructuredErrorFunc error; /* the callback in case of errors */ |
| 261 | xmlError lastError; /* the last error */ |
| 262 | xmlNodePtr debugNode; /* the source node XSLT */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 263 | }; |
| 264 | |
| 265 | /* |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 266 | * The structure of a compiled expression form is not public. |
Daniel Veillard | 9e7160d | 2001-03-18 23:17:47 +0000 | [diff] [blame] | 267 | */ |
| 268 | |
| 269 | typedef struct _xmlXPathCompExpr xmlXPathCompExpr; |
| 270 | typedef xmlXPathCompExpr *xmlXPathCompExprPtr; |
| 271 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 272 | /** |
| 273 | * xmlXPathParserContext: |
| 274 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 275 | * An XPath parser context. It contains pure parsing informations, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 276 | * an xmlXPathContext, and the stack of objects. |
| 277 | */ |
| 278 | struct _xmlXPathParserContext { |
| 279 | const xmlChar *cur; /* the current char being parsed */ |
| 280 | const xmlChar *base; /* the full expression */ |
| 281 | |
| 282 | int error; /* error code */ |
| 283 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 284 | xmlXPathContextPtr context; /* the evaluation context */ |
| 285 | xmlXPathObjectPtr value; /* the current value */ |
| 286 | int valueNr; /* number of values stacked */ |
| 287 | int valueMax; /* max number of values stacked */ |
| 288 | xmlXPathObjectPtr *valueTab; /* stack of values */ |
Daniel Veillard | d007d6c | 2001-03-19 00:01:07 +0000 | [diff] [blame] | 289 | |
| 290 | xmlXPathCompExprPtr comp; /* the precompiled expression */ |
Daniel Veillard | fbf8a2d | 2001-03-19 15:58:54 +0000 | [diff] [blame] | 291 | int xptr; /* it this an XPointer expression */ |
Daniel Veillard | f06307e | 2001-07-03 10:35:50 +0000 | [diff] [blame] | 292 | xmlNodePtr ancestor; /* used for walking preceding axis */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 293 | }; |
| 294 | |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 295 | /** |
| 296 | * xmlXPathFunction: |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 297 | * @ctxt: the XPath interprestation context |
| 298 | * @nargs: the number of arguments |
Daniel Veillard | bed7b05 | 2001-05-19 14:59:49 +0000 | [diff] [blame] | 299 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 300 | * An XPath function. |
Daniel Veillard | 9d06d30 | 2002-01-22 18:15:52 +0000 | [diff] [blame] | 301 | * The arguments (if any) are popped out from the context stack |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 302 | * and the result is pushed on the stack. |
| 303 | */ |
| 304 | |
| 305 | typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); |
| 306 | |
| 307 | /************************************************************************ |
| 308 | * * |
| 309 | * Public API * |
| 310 | * * |
| 311 | ************************************************************************/ |
| 312 | |
| 313 | /** |
Daniel Veillard | afcbe1c | 2001-03-19 10:57:13 +0000 | [diff] [blame] | 314 | * Objects and Nodesets handling |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 315 | */ |
Daniel Veillard | 790142b | 2001-05-15 10:51:53 +0000 | [diff] [blame] | 316 | |
Igor Zlatkovic | 76874e4 | 2003-08-25 09:05:12 +0000 | [diff] [blame] | 317 | XMLPUBVAR double xmlXPathNAN; |
| 318 | XMLPUBVAR double xmlXPathPINF; |
| 319 | XMLPUBVAR double xmlXPathNINF; |
Thomas Broyer | 496be68 | 2001-07-15 22:59:18 +0000 | [diff] [blame] | 320 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 321 | XMLPUBFUN int XMLCALL |
| 322 | xmlXPathIsNaN (double val); |
| 323 | XMLPUBFUN int XMLCALL |
| 324 | xmlXPathIsInf (double val); |
Daniel Veillard | cda9692 | 2001-08-21 10:56:31 +0000 | [diff] [blame] | 325 | |
Daniel Veillard | 790142b | 2001-05-15 10:51:53 +0000 | [diff] [blame] | 326 | /* These macros may later turn into functions */ |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 327 | /** |
| 328 | * xmlXPathNodeSetGetLength: |
| 329 | * @ns: a node-set |
| 330 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 331 | * Implement a functionality similar to the DOM NodeList.length. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 332 | * |
| 333 | * Returns the number of nodes in the node-set. |
| 334 | */ |
Daniel Veillard | 790142b | 2001-05-15 10:51:53 +0000 | [diff] [blame] | 335 | #define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 336 | /** |
| 337 | * xmlXPathNodeSetItem: |
| 338 | * @ns: a node-set |
| 339 | * @index: index of a node in the set |
| 340 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 341 | * Implements a functionality similar to the DOM NodeList.item(). |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 342 | * |
| 343 | * Returns the xmlNodePtr at the given @index in @ns or NULL if |
| 344 | * @index is out of range (0 to length-1) |
| 345 | */ |
Daniel Veillard | 790142b | 2001-05-15 10:51:53 +0000 | [diff] [blame] | 346 | #define xmlXPathNodeSetItem(ns, index) \ |
| 347 | ((((ns) != NULL) && \ |
Thomas Broyer | 496be68 | 2001-07-15 22:59:18 +0000 | [diff] [blame] | 348 | ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ |
Daniel Veillard | 790142b | 2001-05-15 10:51:53 +0000 | [diff] [blame] | 349 | (ns)->nodeTab[(index)] \ |
| 350 | : NULL) |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 351 | /** |
| 352 | * xmlXPathNodeSetIsEmpty: |
| 353 | * @ns: a node-set |
| 354 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 355 | * Checks whether @ns is empty or not. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 356 | * |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 357 | * Returns %TRUE if @ns is an empty node-set. |
Thomas Broyer | f06a3d8 | 2001-07-16 04:52:57 +0000 | [diff] [blame] | 358 | */ |
| 359 | #define xmlXPathNodeSetIsEmpty(ns) \ |
| 360 | (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) |
Daniel Veillard | 790142b | 2001-05-15 10:51:53 +0000 | [diff] [blame] | 361 | |
| 362 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 363 | XMLPUBFUN void XMLCALL |
| 364 | xmlXPathFreeObject (xmlXPathObjectPtr obj); |
| 365 | XMLPUBFUN xmlNodeSetPtr XMLCALL |
| 366 | xmlXPathNodeSetCreate (xmlNodePtr val); |
| 367 | XMLPUBFUN void XMLCALL |
| 368 | xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); |
| 369 | XMLPUBFUN void XMLCALL |
| 370 | xmlXPathFreeNodeSet (xmlNodeSetPtr obj); |
| 371 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 372 | xmlXPathObjectCopy (xmlXPathObjectPtr val); |
| 373 | XMLPUBFUN int XMLCALL |
| 374 | xmlXPathCmpNodes (xmlNodePtr node1, |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 375 | xmlNodePtr node2); |
Daniel Veillard | fbf8a2d | 2001-03-19 15:58:54 +0000 | [diff] [blame] | 376 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 377 | * Conversion functions to basic types. |
Daniel Veillard | fbf8a2d | 2001-03-19 15:58:54 +0000 | [diff] [blame] | 378 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 379 | XMLPUBFUN int XMLCALL |
| 380 | xmlXPathCastNumberToBoolean (double val); |
| 381 | XMLPUBFUN int XMLCALL |
| 382 | xmlXPathCastStringToBoolean (const xmlChar * val); |
| 383 | XMLPUBFUN int XMLCALL |
| 384 | xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); |
| 385 | XMLPUBFUN int XMLCALL |
| 386 | xmlXPathCastToBoolean (xmlXPathObjectPtr val); |
Daniel Veillard | ba0b8c9 | 2001-05-15 09:43:47 +0000 | [diff] [blame] | 387 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 388 | XMLPUBFUN double XMLCALL |
| 389 | xmlXPathCastBooleanToNumber (int val); |
| 390 | XMLPUBFUN double XMLCALL |
| 391 | xmlXPathCastStringToNumber (const xmlChar * val); |
| 392 | XMLPUBFUN double XMLCALL |
| 393 | xmlXPathCastNodeToNumber (xmlNodePtr node); |
| 394 | XMLPUBFUN double XMLCALL |
| 395 | xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); |
| 396 | XMLPUBFUN double XMLCALL |
| 397 | xmlXPathCastToNumber (xmlXPathObjectPtr val); |
Daniel Veillard | ba0b8c9 | 2001-05-15 09:43:47 +0000 | [diff] [blame] | 398 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 399 | XMLPUBFUN xmlChar * XMLCALL |
| 400 | xmlXPathCastBooleanToString (int val); |
| 401 | XMLPUBFUN xmlChar * XMLCALL |
| 402 | xmlXPathCastNumberToString (double val); |
| 403 | XMLPUBFUN xmlChar * XMLCALL |
| 404 | xmlXPathCastNodeToString (xmlNodePtr node); |
| 405 | XMLPUBFUN xmlChar * XMLCALL |
| 406 | xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); |
| 407 | XMLPUBFUN xmlChar * XMLCALL |
| 408 | xmlXPathCastToString (xmlXPathObjectPtr val); |
Daniel Veillard | ba0b8c9 | 2001-05-15 09:43:47 +0000 | [diff] [blame] | 409 | |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 410 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 411 | xmlXPathConvertBoolean (xmlXPathObjectPtr val); |
| 412 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 413 | xmlXPathConvertNumber (xmlXPathObjectPtr val); |
| 414 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 415 | xmlXPathConvertString (xmlXPathObjectPtr val); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 416 | |
Daniel Veillard | afcbe1c | 2001-03-19 10:57:13 +0000 | [diff] [blame] | 417 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 418 | * Context handling. |
Daniel Veillard | afcbe1c | 2001-03-19 10:57:13 +0000 | [diff] [blame] | 419 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 420 | XMLPUBFUN void XMLCALL |
| 421 | xmlXPathInit (void); |
| 422 | XMLPUBFUN xmlXPathContextPtr XMLCALL |
| 423 | xmlXPathNewContext (xmlDocPtr doc); |
| 424 | XMLPUBFUN void XMLCALL |
| 425 | xmlXPathFreeContext (xmlXPathContextPtr ctxt); |
Daniel Veillard | afcbe1c | 2001-03-19 10:57:13 +0000 | [diff] [blame] | 426 | |
| 427 | /** |
| 428 | * Evaluation functions. |
| 429 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 430 | XMLPUBFUN long XMLCALL |
| 431 | xmlXPathOrderDocElems (xmlDocPtr doc); |
| 432 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 433 | xmlXPathEval (const xmlChar *str, |
Daniel Veillard | cbaf399 | 2001-12-31 16:16:02 +0000 | [diff] [blame] | 434 | xmlXPathContextPtr ctx); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 435 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 436 | xmlXPathEvalExpression (const xmlChar *str, |
Daniel Veillard | afcbe1c | 2001-03-19 10:57:13 +0000 | [diff] [blame] | 437 | xmlXPathContextPtr ctxt); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 438 | XMLPUBFUN int XMLCALL |
| 439 | xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, |
Daniel Veillard | fbf8a2d | 2001-03-19 15:58:54 +0000 | [diff] [blame] | 440 | xmlXPathObjectPtr res); |
Daniel Veillard | afcbe1c | 2001-03-19 10:57:13 +0000 | [diff] [blame] | 441 | /** |
Daniel Veillard | 61f2617 | 2002-03-12 18:46:39 +0000 | [diff] [blame] | 442 | * Separate compilation/evaluation entry points. |
Daniel Veillard | afcbe1c | 2001-03-19 10:57:13 +0000 | [diff] [blame] | 443 | */ |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 444 | XMLPUBFUN xmlXPathCompExprPtr XMLCALL |
| 445 | xmlXPathCompile (const xmlChar *str); |
| 446 | XMLPUBFUN xmlXPathObjectPtr XMLCALL |
| 447 | xmlXPathCompiledEval (xmlXPathCompExprPtr comp, |
Daniel Veillard | afcbe1c | 2001-03-19 10:57:13 +0000 | [diff] [blame] | 448 | xmlXPathContextPtr ctx); |
Igor Zlatkovic | aa3cfbd | 2003-08-27 08:59:58 +0000 | [diff] [blame] | 449 | XMLPUBFUN void XMLCALL |
| 450 | xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 451 | #ifdef __cplusplus |
| 452 | } |
| 453 | #endif |
| 454 | #endif /* ! __XML_XPATH_H__ */ |