blob: 6b2bfa3a8ae7bb481a0416a5b621dd5a29d0bd60 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
Daniel Veillardbe586972003-11-18 20:56:51 +00002 * Summary: XML Path Language implementation
3 * Description: API for the XML Path Language implementation
Owen Taylor3473f882001-02-23 17:55:21 +00004 *
Daniel Veillardbe586972003-11-18 20:56:51 +00005 * XML Path Language implementation
6 * XPath is a language for addressing parts of an XML document,
7 * designed to be used by both XSLT and XPointer
8 * http://www.w3.org/TR/xpath
Owen Taylor3473f882001-02-23 17:55:21 +00009 *
Daniel Veillardbe586972003-11-18 20:56:51 +000010 * Implements
11 * W3C Recommendation 16 November 1999
12 * http://www.w3.org/TR/1999/REC-xpath-19991116
Owen Taylor3473f882001-02-23 17:55:21 +000013 *
Daniel Veillardbe586972003-11-18 20:56:51 +000014 * Copy: See Copyright for the status of this software.
15 *
16 * Author: Daniel Veillard
Owen Taylor3473f882001-02-23 17:55:21 +000017 */
18
19#ifndef __XML_XPATH_H__
20#define __XML_XPATH_H__
21
Igor Zlatkovic76874e42003-08-25 09:05:12 +000022#include <libxml/xmlversion.h>
Daniel Veillarda2351322004-06-27 12:08:10 +000023
24#ifdef LIBXML_XPATH_ENABLED
25
Daniel Veillardd96f6d32003-10-07 21:25:12 +000026#include <libxml/xmlerror.h>
Owen Taylor3473f882001-02-23 17:55:21 +000027#include <libxml/tree.h>
28#include <libxml/hash.h>
William M. Brack21e4ef22005-01-02 09:53:13 +000029#endif /* LIBXML_XPATH_ENABLED */
Owen Taylor3473f882001-02-23 17:55:21 +000030
William M. Brack21e4ef22005-01-02 09:53:13 +000031#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Owen Taylor3473f882001-02-23 17:55:21 +000032#ifdef __cplusplus
33extern "C" {
34#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000035#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */
36
37#ifdef LIBXML_XPATH_ENABLED
Owen Taylor3473f882001-02-23 17:55:21 +000038typedef struct _xmlXPathContext xmlXPathContext;
39typedef xmlXPathContext *xmlXPathContextPtr;
40typedef struct _xmlXPathParserContext xmlXPathParserContext;
41typedef xmlXPathParserContext *xmlXPathParserContextPtr;
42
43/**
Daniel Veillard61f26172002-03-12 18:46:39 +000044 * The set of XPath error codes.
Owen Taylor3473f882001-02-23 17:55:21 +000045 */
46
47typedef enum {
48 XPATH_EXPRESSION_OK = 0,
49 XPATH_NUMBER_ERROR,
50 XPATH_UNFINISHED_LITERAL_ERROR,
51 XPATH_START_LITERAL_ERROR,
52 XPATH_VARIABLE_REF_ERROR,
53 XPATH_UNDEF_VARIABLE_ERROR,
54 XPATH_INVALID_PREDICATE_ERROR,
55 XPATH_EXPR_ERROR,
56 XPATH_UNCLOSED_ERROR,
57 XPATH_UNKNOWN_FUNC_ERROR,
58 XPATH_INVALID_OPERAND,
59 XPATH_INVALID_TYPE,
60 XPATH_INVALID_ARITY,
61 XPATH_INVALID_CTXT_SIZE,
62 XPATH_INVALID_CTXT_POSITION,
63 XPATH_MEMORY_ERROR,
64 XPTR_SYNTAX_ERROR,
65 XPTR_RESOURCE_ERROR,
66 XPTR_SUB_RESOURCE_ERROR,
Daniel Veillard61d80a22001-04-27 17:13:01 +000067 XPATH_UNDEF_PREFIX_ERROR,
68 XPATH_ENCODING_ERROR,
Daniel Veillard57b25162004-11-06 14:50:18 +000069 XPATH_INVALID_CHAR_ERROR,
70 XPATH_INVALID_CTXT
Owen Taylor3473f882001-02-23 17:55:21 +000071} xmlXPathError;
72
73/*
Daniel Veillard61f26172002-03-12 18:46:39 +000074 * A node-set (an unordered collection of nodes without duplicates).
Owen Taylor3473f882001-02-23 17:55:21 +000075 */
76typedef struct _xmlNodeSet xmlNodeSet;
77typedef xmlNodeSet *xmlNodeSetPtr;
78struct _xmlNodeSet {
79 int nodeNr; /* number of nodes in the set */
80 int nodeMax; /* size of the array as allocated */
81 xmlNodePtr *nodeTab; /* array of nodes in no particular order */
Daniel Veillard044fc6b2002-03-04 17:09:44 +000082 /* @@ with_ns to check wether namespace nodes should be looked at @@ */
Owen Taylor3473f882001-02-23 17:55:21 +000083};
84
85/*
86 * An expression is evaluated to yield an object, which
87 * has one of the following four basic types:
88 * - node-set
89 * - boolean
90 * - number
91 * - string
92 *
93 * @@ XPointer will add more types !
94 */
95
96typedef enum {
97 XPATH_UNDEFINED = 0,
98 XPATH_NODESET = 1,
99 XPATH_BOOLEAN = 2,
100 XPATH_NUMBER = 3,
101 XPATH_STRING = 4,
102 XPATH_POINT = 5,
103 XPATH_RANGE = 6,
104 XPATH_LOCATIONSET = 7,
105 XPATH_USERS = 8,
106 XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
107} xmlXPathObjectType;
108
109typedef struct _xmlXPathObject xmlXPathObject;
110typedef xmlXPathObject *xmlXPathObjectPtr;
111struct _xmlXPathObject {
112 xmlXPathObjectType type;
113 xmlNodeSetPtr nodesetval;
114 int boolval;
115 double floatval;
116 xmlChar *stringval;
117 void *user;
118 int index;
119 void *user2;
120 int index2;
121};
122
Daniel Veillard9d06d302002-01-22 18:15:52 +0000123/**
124 * xmlXPathConvertFunc:
125 * @obj: an XPath object
126 * @type: the number of the target type
127 *
Owen Taylor3473f882001-02-23 17:55:21 +0000128 * A conversion function is associated to a type and used to cast
129 * the new type to primitive values.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000130 *
131 * Returns -1 in case of error, 0 otherwise
Owen Taylor3473f882001-02-23 17:55:21 +0000132 */
133typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
134
135/*
136 * Extra type: a name and a conversion function.
137 */
138
139typedef struct _xmlXPathType xmlXPathType;
140typedef xmlXPathType *xmlXPathTypePtr;
141struct _xmlXPathType {
142 const xmlChar *name; /* the type name */
143 xmlXPathConvertFunc func; /* the conversion function */
144};
145
146/*
147 * Extra variable: a name and a value.
148 */
149
150typedef struct _xmlXPathVariable xmlXPathVariable;
151typedef xmlXPathVariable *xmlXPathVariablePtr;
152struct _xmlXPathVariable {
153 const xmlChar *name; /* the variable name */
154 xmlXPathObjectPtr value; /* the value */
155};
156
Daniel Veillard5168dbf2001-07-07 00:18:23 +0000157/**
158 * xmlXPathEvalFunc:
159 * @ctxt: an XPath parser context
160 * @nargs: the number of arguments passed to the function
161 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000162 * An XPath evaluation function, the parameters are on the XPath context stack.
Owen Taylor3473f882001-02-23 17:55:21 +0000163 */
164
Daniel Veillard5168dbf2001-07-07 00:18:23 +0000165typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
166 int nargs);
Owen Taylor3473f882001-02-23 17:55:21 +0000167
168/*
169 * Extra function: a name and a evaluation function.
170 */
171
172typedef struct _xmlXPathFunct xmlXPathFunct;
173typedef xmlXPathFunct *xmlXPathFuncPtr;
174struct _xmlXPathFunct {
175 const xmlChar *name; /* the function name */
176 xmlXPathEvalFunc func; /* the evaluation function */
177};
178
Daniel Veillard9d06d302002-01-22 18:15:52 +0000179/**
180 * xmlXPathAxisFunc:
181 * @ctxt: the XPath interpreter context
182 * @cur: the previous node being explored on that axis
183 *
Owen Taylor3473f882001-02-23 17:55:21 +0000184 * An axis traversal function. To traverse an axis, the engine calls
185 * the first time with cur == NULL and repeat until the function returns
186 * NULL indicating the end of the axis traversal.
Daniel Veillard9d06d302002-01-22 18:15:52 +0000187 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000188 * Returns the next node in that axis or NULL if at the end of the axis.
Owen Taylor3473f882001-02-23 17:55:21 +0000189 */
190
Daniel Veillard9d06d302002-01-22 18:15:52 +0000191typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
192 xmlXPathObjectPtr cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000193
194/*
195 * Extra axis: a name and an axis function.
196 */
197
198typedef struct _xmlXPathAxis xmlXPathAxis;
199typedef xmlXPathAxis *xmlXPathAxisPtr;
200struct _xmlXPathAxis {
201 const xmlChar *name; /* the axis name */
202 xmlXPathAxisFunc func; /* the search function */
203};
204
Daniel Veillardbed7b052001-05-19 14:59:49 +0000205/**
Daniel Veillard6ebf3c42004-08-22 13:11:39 +0000206 * xmlXPathFunction:
207 * @ctxt: the XPath interprestation context
208 * @nargs: the number of arguments
209 *
210 * An XPath function.
211 * The arguments (if any) are popped out from the context stack
212 * and the result is pushed on the stack.
213 */
214
215typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
216
217/*
218 * Function and Variable Lookup.
219 */
220
221/**
222 * xmlXPathVariableLookupFunc:
223 * @ctxt: an XPath context
224 * @name: name of the variable
225 * @ns_uri: the namespace name hosting this variable
226 *
227 * Prototype for callbacks used to plug variable lookup in the XPath
228 * engine.
229 *
230 * Returns the XPath object value or NULL if not found.
231 */
232typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
233 const xmlChar *name,
234 const xmlChar *ns_uri);
235
236/**
237 * xmlXPathFuncLookupFunc:
238 * @ctxt: an XPath context
239 * @name: name of the function
240 * @ns_uri: the namespace name hosting this function
241 *
242 * Prototype for callbacks used to plug function lookup in the XPath
243 * engine.
244 *
245 * Returns the XPath function or NULL if not found.
246 */
247typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
248 const xmlChar *name,
249 const xmlChar *ns_uri);
250
251/**
Daniel Veillarded6c5492005-07-23 15:00:22 +0000252 * xmlXPathFlags:
253 * Flags for XPath engine compilation and runtime
254 */
255typedef enum {
256 XML_XPATH_CHECKNS = 1 /* check namespaces at compilation */
257} xmlXPathFlags;
258
259/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000260 * xmlXPathContext:
261 *
Owen Taylor3473f882001-02-23 17:55:21 +0000262 * Expression evaluation occurs with respect to a context.
263 * he context consists of:
264 * - a node (the context node)
265 * - a node list (the context node list)
266 * - a set of variable bindings
267 * - a function library
268 * - the set of namespace declarations in scope for the expression
269 * Following the switch to hash tables, this need to be trimmed up at
270 * the next binary incompatible release.
271 */
272
273struct _xmlXPathContext {
274 xmlDocPtr doc; /* The current document */
275 xmlNodePtr node; /* The current node */
276
277 int nb_variables_unused; /* unused (hash table) */
278 int max_variables_unused; /* unused (hash table) */
279 xmlHashTablePtr varHash; /* Hash table of defined variables */
280
281 int nb_types; /* number of defined types */
282 int max_types; /* max number of types */
283 xmlXPathTypePtr types; /* Array of defined types */
284
285 int nb_funcs_unused; /* unused (hash table) */
286 int max_funcs_unused; /* unused (hash table) */
287 xmlHashTablePtr funcHash; /* Hash table of defined funcs */
288
289 int nb_axis; /* number of defined axis */
290 int max_axis; /* max number of axis */
291 xmlXPathAxisPtr axis; /* Array of defined axis */
292
293 /* the namespace nodes of the context node */
294 xmlNsPtr *namespaces; /* Array of namespaces */
295 int nsNr; /* number of namespace in scope */
296 void *user; /* function to free */
297
298 /* extra variables */
299 int contextSize; /* the context size */
300 int proximityPosition; /* the proximity position */
301
302 /* extra stuff for XPointer */
303 int xptr; /* it this an XPointer context */
304 xmlNodePtr here; /* for here() */
305 xmlNodePtr origin; /* for origin() */
306
307 /* the set of namespace declarations in scope for the expression */
308 xmlHashTablePtr nsHash; /* The namespaces hash table */
Daniel Veillard6ebf3c42004-08-22 13:11:39 +0000309 xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */
Owen Taylor3473f882001-02-23 17:55:21 +0000310 void *varLookupData; /* variable lookup data */
311
312 /* Possibility to link in an extra item */
313 void *extra; /* needed for XSLT */
Daniel Veillard42596ad2001-05-22 16:57:14 +0000314
315 /* The function name and URI when calling a function */
316 const xmlChar *function;
317 const xmlChar *functionURI;
Thomas Broyerba4ad322001-07-26 16:55:21 +0000318
319 /* function lookup function and data */
Daniel Veillard6ebf3c42004-08-22 13:11:39 +0000320 xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */
Thomas Broyerba4ad322001-07-26 16:55:21 +0000321 void *funcLookupData; /* function lookup data */
Daniel Veillard7d7e3792001-07-30 13:42:13 +0000322
323 /* temporary namespace lists kept for walking the namespace axis */
324 xmlNsPtr *tmpNsList; /* Array of namespaces */
325 int tmpNsNr; /* number of namespace in scope */
Daniel Veillardd96f6d32003-10-07 21:25:12 +0000326
327 /* error reporting mechanism */
328 void *userData; /* user specific data block */
329 xmlStructuredErrorFunc error; /* the callback in case of errors */
330 xmlError lastError; /* the last error */
331 xmlNodePtr debugNode; /* the source node XSLT */
Daniel Veillard4773df22004-01-23 13:15:13 +0000332
333 /* dictionnary */
334 xmlDictPtr dict; /* dictionnary if any */
Daniel Veillarded6c5492005-07-23 15:00:22 +0000335
336 int flags; /* flags to control compilation */
Owen Taylor3473f882001-02-23 17:55:21 +0000337};
338
339/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000340 * The structure of a compiled expression form is not public.
Daniel Veillard9e7160d2001-03-18 23:17:47 +0000341 */
342
343typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
344typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
345
Daniel Veillardbed7b052001-05-19 14:59:49 +0000346/**
347 * xmlXPathParserContext:
348 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000349 * An XPath parser context. It contains pure parsing informations,
Owen Taylor3473f882001-02-23 17:55:21 +0000350 * an xmlXPathContext, and the stack of objects.
351 */
352struct _xmlXPathParserContext {
353 const xmlChar *cur; /* the current char being parsed */
354 const xmlChar *base; /* the full expression */
355
356 int error; /* error code */
357
Owen Taylor3473f882001-02-23 17:55:21 +0000358 xmlXPathContextPtr context; /* the evaluation context */
359 xmlXPathObjectPtr value; /* the current value */
360 int valueNr; /* number of values stacked */
361 int valueMax; /* max number of values stacked */
362 xmlXPathObjectPtr *valueTab; /* stack of values */
Daniel Veillardd007d6c2001-03-19 00:01:07 +0000363
364 xmlXPathCompExprPtr comp; /* the precompiled expression */
Daniel Veillardfbf8a2d2001-03-19 15:58:54 +0000365 int xptr; /* it this an XPointer expression */
Daniel Veillardf06307e2001-07-03 10:35:50 +0000366 xmlNodePtr ancestor; /* used for walking preceding axis */
Owen Taylor3473f882001-02-23 17:55:21 +0000367};
368
Owen Taylor3473f882001-02-23 17:55:21 +0000369/************************************************************************
370 * *
371 * Public API *
372 * *
373 ************************************************************************/
374
375/**
Daniel Veillardafcbe1c2001-03-19 10:57:13 +0000376 * Objects and Nodesets handling
Owen Taylor3473f882001-02-23 17:55:21 +0000377 */
Daniel Veillard790142b2001-05-15 10:51:53 +0000378
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000379XMLPUBVAR double xmlXPathNAN;
380XMLPUBVAR double xmlXPathPINF;
381XMLPUBVAR double xmlXPathNINF;
Thomas Broyer496be682001-07-15 22:59:18 +0000382
Daniel Veillard790142b2001-05-15 10:51:53 +0000383/* These macros may later turn into functions */
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000384/**
385 * xmlXPathNodeSetGetLength:
386 * @ns: a node-set
387 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000388 * Implement a functionality similar to the DOM NodeList.length.
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000389 *
390 * Returns the number of nodes in the node-set.
391 */
Daniel Veillard790142b2001-05-15 10:51:53 +0000392#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000393/**
394 * xmlXPathNodeSetItem:
395 * @ns: a node-set
396 * @index: index of a node in the set
397 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000398 * Implements a functionality similar to the DOM NodeList.item().
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000399 *
400 * Returns the xmlNodePtr at the given @index in @ns or NULL if
401 * @index is out of range (0 to length-1)
402 */
Daniel Veillard790142b2001-05-15 10:51:53 +0000403#define xmlXPathNodeSetItem(ns, index) \
404 ((((ns) != NULL) && \
Thomas Broyer496be682001-07-15 22:59:18 +0000405 ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
Daniel Veillard790142b2001-05-15 10:51:53 +0000406 (ns)->nodeTab[(index)] \
407 : NULL)
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000408/**
409 * xmlXPathNodeSetIsEmpty:
410 * @ns: a node-set
411 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000412 * Checks whether @ns is empty or not.
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000413 *
Daniel Veillard61f26172002-03-12 18:46:39 +0000414 * Returns %TRUE if @ns is an empty node-set.
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000415 */
416#define xmlXPathNodeSetIsEmpty(ns) \
417 (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
Daniel Veillard790142b2001-05-15 10:51:53 +0000418
419
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000420XMLPUBFUN void XMLCALL
421 xmlXPathFreeObject (xmlXPathObjectPtr obj);
422XMLPUBFUN xmlNodeSetPtr XMLCALL
423 xmlXPathNodeSetCreate (xmlNodePtr val);
424XMLPUBFUN void XMLCALL
425 xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
426XMLPUBFUN void XMLCALL
427 xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
428XMLPUBFUN xmlXPathObjectPtr XMLCALL
429 xmlXPathObjectCopy (xmlXPathObjectPtr val);
430XMLPUBFUN int XMLCALL
431 xmlXPathCmpNodes (xmlNodePtr node1,
Owen Taylor3473f882001-02-23 17:55:21 +0000432 xmlNodePtr node2);
Daniel Veillardfbf8a2d2001-03-19 15:58:54 +0000433/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000434 * Conversion functions to basic types.
Daniel Veillardfbf8a2d2001-03-19 15:58:54 +0000435 */
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000436XMLPUBFUN int XMLCALL
437 xmlXPathCastNumberToBoolean (double val);
438XMLPUBFUN int XMLCALL
439 xmlXPathCastStringToBoolean (const xmlChar * val);
440XMLPUBFUN int XMLCALL
441 xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
442XMLPUBFUN int XMLCALL
443 xmlXPathCastToBoolean (xmlXPathObjectPtr val);
Daniel Veillardba0b8c92001-05-15 09:43:47 +0000444
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000445XMLPUBFUN double XMLCALL
446 xmlXPathCastBooleanToNumber (int val);
447XMLPUBFUN double XMLCALL
448 xmlXPathCastStringToNumber (const xmlChar * val);
449XMLPUBFUN double XMLCALL
450 xmlXPathCastNodeToNumber (xmlNodePtr node);
451XMLPUBFUN double XMLCALL
452 xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
453XMLPUBFUN double XMLCALL
454 xmlXPathCastToNumber (xmlXPathObjectPtr val);
Daniel Veillardba0b8c92001-05-15 09:43:47 +0000455
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000456XMLPUBFUN xmlChar * XMLCALL
457 xmlXPathCastBooleanToString (int val);
458XMLPUBFUN xmlChar * XMLCALL
459 xmlXPathCastNumberToString (double val);
460XMLPUBFUN xmlChar * XMLCALL
461 xmlXPathCastNodeToString (xmlNodePtr node);
462XMLPUBFUN xmlChar * XMLCALL
463 xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
464XMLPUBFUN xmlChar * XMLCALL
465 xmlXPathCastToString (xmlXPathObjectPtr val);
Daniel Veillardba0b8c92001-05-15 09:43:47 +0000466
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000467XMLPUBFUN xmlXPathObjectPtr XMLCALL
468 xmlXPathConvertBoolean (xmlXPathObjectPtr val);
469XMLPUBFUN xmlXPathObjectPtr XMLCALL
470 xmlXPathConvertNumber (xmlXPathObjectPtr val);
471XMLPUBFUN xmlXPathObjectPtr XMLCALL
472 xmlXPathConvertString (xmlXPathObjectPtr val);
Owen Taylor3473f882001-02-23 17:55:21 +0000473
Daniel Veillardafcbe1c2001-03-19 10:57:13 +0000474/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000475 * Context handling.
Daniel Veillardafcbe1c2001-03-19 10:57:13 +0000476 */
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000477XMLPUBFUN xmlXPathContextPtr XMLCALL
478 xmlXPathNewContext (xmlDocPtr doc);
479XMLPUBFUN void XMLCALL
480 xmlXPathFreeContext (xmlXPathContextPtr ctxt);
Daniel Veillardafcbe1c2001-03-19 10:57:13 +0000481
482/**
483 * Evaluation functions.
484 */
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000485XMLPUBFUN long XMLCALL
486 xmlXPathOrderDocElems (xmlDocPtr doc);
487XMLPUBFUN xmlXPathObjectPtr XMLCALL
488 xmlXPathEval (const xmlChar *str,
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000489 xmlXPathContextPtr ctx);
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000490XMLPUBFUN xmlXPathObjectPtr XMLCALL
491 xmlXPathEvalExpression (const xmlChar *str,
Daniel Veillardafcbe1c2001-03-19 10:57:13 +0000492 xmlXPathContextPtr ctxt);
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000493XMLPUBFUN int XMLCALL
494 xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
Daniel Veillardfbf8a2d2001-03-19 15:58:54 +0000495 xmlXPathObjectPtr res);
Daniel Veillardafcbe1c2001-03-19 10:57:13 +0000496/**
Daniel Veillard61f26172002-03-12 18:46:39 +0000497 * Separate compilation/evaluation entry points.
Daniel Veillardafcbe1c2001-03-19 10:57:13 +0000498 */
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000499XMLPUBFUN xmlXPathCompExprPtr XMLCALL
500 xmlXPathCompile (const xmlChar *str);
Daniel Veillard4773df22004-01-23 13:15:13 +0000501XMLPUBFUN xmlXPathCompExprPtr XMLCALL
502 xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
503 const xmlChar *str);
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000504XMLPUBFUN xmlXPathObjectPtr XMLCALL
505 xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
Daniel Veillardafcbe1c2001-03-19 10:57:13 +0000506 xmlXPathContextPtr ctx);
Igor Zlatkovicaa3cfbd2003-08-27 08:59:58 +0000507XMLPUBFUN void XMLCALL
508 xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
William M. Brack21e4ef22005-01-02 09:53:13 +0000509#endif /* LIBXML_XPATH_ENABLED */
510#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
511XMLPUBFUN void XMLCALL
512 xmlXPathInit (void);
513XMLPUBFUN int XMLCALL
514 xmlXPathIsNaN (double val);
515XMLPUBFUN int XMLCALL
516 xmlXPathIsInf (double val);
517
Owen Taylor3473f882001-02-23 17:55:21 +0000518#ifdef __cplusplus
519}
520#endif
Daniel Veillarda2351322004-06-27 12:08:10 +0000521
William M. Brack21e4ef22005-01-02 09:53:13 +0000522#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
Owen Taylor3473f882001-02-23 17:55:21 +0000523#endif /* ! __XML_XPATH_H__ */