blob: ccbf53fee7fe7c548efdfd7f801105f40ffbc2f0 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
Daniel Veillardcbaf3992001-12-31 16:16:02 +00002 * xpathInternals.c: internal interfaces for XML Path Language implementation
3 * used to build new modules on top of XPath
Owen Taylor3473f882001-02-23 17:55:21 +00004 *
5 * See COPYRIGHT for the status of this software
6 *
Daniel Veillardc5d64342001-06-24 12:13:24 +00007 * Author: daniel@veillard.com
Owen Taylor3473f882001-02-23 17:55:21 +00008 */
9
10#ifndef __XML_XPATH_INTERNALS_H__
11#define __XML_XPATH_INTERNALS_H__
12
Daniel Veillardc5d64342001-06-24 12:13:24 +000013#if defined(WIN32) && defined(_MSC_VER)
14#include <libxml/xmlwin32version.h>
15#else
Daniel Veillard017b1082001-06-21 11:20:21 +000016#include <libxml/xmlversion.h>
Daniel Veillardc5d64342001-06-24 12:13:24 +000017#endif
Owen Taylor3473f882001-02-23 17:55:21 +000018#include <libxml/xpath.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/************************************************************************
25 * *
26 * Helpers *
27 * *
28 ************************************************************************/
29
Daniel Veillard8fcc4942001-07-17 20:07:33 +000030/**
31 * Many of these macros may later turn into functions. They
32 * shouldn't be used in #ifdef's preprocessor instructions.
33 */
Thomas Broyerf06a3d82001-07-16 04:52:57 +000034/**
35 * xmlXPathSetError:
36 * @ctxt: an XPath parser context
37 * @err: an xmlXPathError code
38 *
39 * Raises an error.
40 */
41#define xmlXPathSetError(ctxt, err) \
42 { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
43 (ctxt)->error = (err); }
Daniel Veillard8fcc4942001-07-17 20:07:33 +000044
Thomas Broyerf06a3d82001-07-16 04:52:57 +000045/**
46 * xmlXPathSetArityError:
47 * @ctxt: an XPath parser context
48 *
49 * Raises an XPATH_INVALID_ARITY error
50 */
51#define xmlXPathSetArityError(ctxt) \
52 xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
Daniel Veillard8fcc4942001-07-17 20:07:33 +000053
Thomas Broyerf06a3d82001-07-16 04:52:57 +000054/**
55 * xmlXPathSetTypeError:
56 * @ctxt: an XPath parser context
57 *
58 * Raises an XPATH_INVALID_TYPE error
59 */
60#define xmlXPathSetTypeError(ctxt) \
61 xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
Daniel Veillard8fcc4942001-07-17 20:07:33 +000062
Thomas Broyerf06a3d82001-07-16 04:52:57 +000063/**
64 * xmlXPathGetError:
65 * @ctxt: an XPath parser context
66 *
Daniel Veillard5e2dace2001-07-18 19:30:27 +000067 * Get the error code of an XPath context
68 *
Thomas Broyerf06a3d82001-07-16 04:52:57 +000069 * Returns the context error
70 */
71#define xmlXPathGetError(ctxt) ((ctxt)->error)
Daniel Veillard8fcc4942001-07-17 20:07:33 +000072
Thomas Broyerf06a3d82001-07-16 04:52:57 +000073/**
74 * xmlXPathCheckError:
75 * @ctxt: an XPath parser context
76 *
Daniel Veillard5e2dace2001-07-18 19:30:27 +000077 * Check if an XPath error was raised
78 *
Thomas Broyerf06a3d82001-07-16 04:52:57 +000079 * Returns true if an error has been raised, false otherwise.
80 */
81#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK)
82
83/**
84 * xmlXPathGetDocument:
85 * @ctxt: an XPath parser context
86 *
Daniel Veillard5e2dace2001-07-18 19:30:27 +000087 * Get the document of an XPath context
88 *
Thomas Broyerf06a3d82001-07-16 04:52:57 +000089 * Returns the context document
90 */
91#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc)
Daniel Veillard8fcc4942001-07-17 20:07:33 +000092
Thomas Broyerf06a3d82001-07-16 04:52:57 +000093/**
94 * xmlXPathGetContextNode:
95 * @ctxt: an XPath parser context
96 *
Daniel Veillard5e2dace2001-07-18 19:30:27 +000097 * Get the context node of an XPath context
98 *
Thomas Broyerf06a3d82001-07-16 04:52:57 +000099 * Returns the context node
100 */
101#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
102
103int xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
104double xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
105xmlChar * xmlXPathPopString (xmlXPathParserContextPtr ctxt);
106xmlNodeSetPtr xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
107void * xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
108
109/**
110 * xmlXPathReturnBoolean:
111 * @ctxt: an XPath parser context
112 * @val: a boolean
113 *
114 * Pushes the boolean @val on the context stack
115 */
116#define xmlXPathReturnBoolean(ctxt, val) \
117 valuePush((ctxt), xmlXPathNewBoolean(val))
Daniel Veillard8fcc4942001-07-17 20:07:33 +0000118
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000119/**
120 * xmlXPathReturnTrue:
121 * @ctxt: an XPath parser context
122 *
123 * Pushes true on the context stack
124 */
125#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1)
Daniel Veillard8fcc4942001-07-17 20:07:33 +0000126
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000127/**
128 * xmlXPathReturnFalse:
129 * @ctxt: an XPath parser context
130 *
131 * Pushes false on the context stack
132 */
133#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0)
Daniel Veillard8fcc4942001-07-17 20:07:33 +0000134
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000135/**
136 * xmlXPathReturnNumber:
137 * @ctxt: an XPath parser context
138 * @val: a double
139 *
140 * Pushes the double @val on the context stack
141 */
142#define xmlXPathReturnNumber(ctxt, val) \
143 valuePush((ctxt), xmlXPathNewFloat(val))
Daniel Veillard8fcc4942001-07-17 20:07:33 +0000144
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000145/**
146 * xmlXPathReturnString:
147 * @ctxt: an XPath parser context
148 * @str: a string
149 *
150 * Pushes the string @str on the context stack
151 */
152#define xmlXPathReturnString(ctxt, str) \
153 valuePush((ctxt), xmlXPathWrapString(str))
Daniel Veillard8fcc4942001-07-17 20:07:33 +0000154
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000155/**
156 * xmlXPathReturnEmptyString:
157 * @ctxt: an XPath parser context
158 *
159 * Pushes an empty string on the stack
160 */
161#define xmlXPathReturnEmptyString(ctxt) \
162 valuePush((ctxt), xmlXPathNewCString(""))
Daniel Veillard8fcc4942001-07-17 20:07:33 +0000163
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000164/**
165 * xmlXPathReturnNodeSet:
166 * @ctxt: an XPath parser context
167 * @ns: a node-set
168 *
169 * Pushes the node-set @ns on the context stack
170 */
171#define xmlXPathReturnNodeSet(ctxt, ns) \
172 valuePush((ctxt), xmlXPathWrapNodeSet(ns))
Daniel Veillard8fcc4942001-07-17 20:07:33 +0000173
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000174/**
175 * xmlXPathReturnEmptyNodeSet:
176 * @ctxt: an XPath parser context
177 *
178 * Pushes an empty node-set on the context stack
179 */
Daniel Veillard5344c602001-12-31 16:37:34 +0000180#define xmlXPathReturnEmptyNodeSet(ctxt) \
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000181 valuePush((ctxt), xmlXPathNewNodeSet(NULL))
Daniel Veillard8fcc4942001-07-17 20:07:33 +0000182
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000183/**
184 * xmlXPathReturnExternal:
185 * @ctxt: an XPath parser context
186 * @val: user data
187 *
188 * Pushes user data on the context stack
189 */
190#define xmlXPathReturnExternal(ctxt, val) \
191 valuePush((ctxt), xmlXPathWrapExternal(val))
192
193/**
194 * xmlXPathStackIsNodeSet:
195 * @ctxt: an XPath parser context
196 *
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000197 * Check if the current value on the XPath stack is a node set or
198 * an XSLT value tree
199 *
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000200 * Returns true if the current object on the stack is a node-set
201 */
202#define xmlXPathStackIsNodeSet(ctxt) \
203 (((ctxt)->value != NULL) \
204 && (((ctxt)->value->type == XPATH_NODESET) \
205 || ((ctxt)->value->type == XPATH_XSLT_TREE)))
206
207/**
Thomas Broyer47334c02001-10-07 16:41:52 +0000208 * xmlXPathStackIsExternal:
209 * @ctxt: an XPath parser context
210 *
211 * Checks if the current value on the XPath stack is an external
212 * object.
213 *
214 * Returns true if the current object on the stack is an external
215 * object
216 */
217#define xmlXPathStackIsExternal(ctxt) \
218 ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
219
220/**
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000221 * xmlXPathEmptyNodeSet:
222 * @ns: a node-set
223 *
224 * Empties a node-set
225 */
226#define xmlXPathEmptyNodeSet(ns) \
227 { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; }
228
Daniel Veillardbed7b052001-05-19 14:59:49 +0000229/**
230 * CHECK_ERROR:
231 *
232 * macro to return from the function if an XPath error was detected
233 */
Owen Taylor3473f882001-02-23 17:55:21 +0000234#define CHECK_ERROR \
235 if (ctxt->error != XPATH_EXPRESSION_OK) return
236
Daniel Veillardbed7b052001-05-19 14:59:49 +0000237/**
238 * CHECK_ERROR0:
239 *
240 * macro to return 0 from the function if an XPath error was detected
241 */
Owen Taylor3473f882001-02-23 17:55:21 +0000242#define CHECK_ERROR0 \
243 if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
244
Daniel Veillardbed7b052001-05-19 14:59:49 +0000245/**
246 * XP_ERROR:
247 * @X: the error code
248 *
249 * Macro to raise an XPath error and return
250 */
Owen Taylor3473f882001-02-23 17:55:21 +0000251#define XP_ERROR(X) \
252 { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \
253 ctxt->error = (X); return; }
254
Daniel Veillardbed7b052001-05-19 14:59:49 +0000255/**
256 * XP_ERROR0:
257 * @X: the error code
258 *
259 * Macro to raise an XPath error and return 0
260 */
Owen Taylor3473f882001-02-23 17:55:21 +0000261#define XP_ERROR0(X) \
262 { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \
263 ctxt->error = (X); return(0); }
264
Daniel Veillardbed7b052001-05-19 14:59:49 +0000265/**
266 * CHECK_TYPE:
267 * @typeval: the XPath type
268 *
269 * Macro to check that the value on top of the XPath stack is of a given
270 * type.
271 */
Owen Taylor3473f882001-02-23 17:55:21 +0000272#define CHECK_TYPE(typeval) \
273 if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
274 XP_ERROR(XPATH_INVALID_TYPE)
275
Daniel Veillardbed7b052001-05-19 14:59:49 +0000276/**
Daniel Veillardf06307e2001-07-03 10:35:50 +0000277 * CHECK_TYPE0:
278 * @typeval: the XPath type
279 *
280 * Macro to check that the value on top of the XPath stack is of a given
281 * type. return(0) in case of failure
282 */
283#define CHECK_TYPE0(typeval) \
284 if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
285 XP_ERROR0(XPATH_INVALID_TYPE)
286
287/**
Daniel Veillardbed7b052001-05-19 14:59:49 +0000288 * CHECK_ARITY:
289 * @x: the number of expected args
290 *
291 * Macro to check that the number of args passed to an XPath function matches
292 */
Owen Taylor3473f882001-02-23 17:55:21 +0000293#define CHECK_ARITY(x) \
294 if (nargs != (x)) \
295 XP_ERROR(XPATH_INVALID_ARITY);
296
Daniel Veillardbed7b052001-05-19 14:59:49 +0000297/**
298 * CAST_TO_STRING:
299 *
300 * Macro to try to cast the value on the top of the XPath stack to a string
301 */
Owen Taylor3473f882001-02-23 17:55:21 +0000302#define CAST_TO_STRING \
303 if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
304 xmlXPathStringFunction(ctxt, 1);
305
Daniel Veillardbed7b052001-05-19 14:59:49 +0000306/**
307 * CAST_TO_NUMBER:
308 *
309 * Macro to try to cast the value on the top of the XPath stack to a number
310 */
Owen Taylor3473f882001-02-23 17:55:21 +0000311#define CAST_TO_NUMBER \
312 if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
313 xmlXPathNumberFunction(ctxt, 1);
314
Daniel Veillardbed7b052001-05-19 14:59:49 +0000315/**
316 * CAST_TO_BOOLEAN:
317 *
318 * Macro to try to cast the value on the top of the XPath stack to a boolean
319 */
Owen Taylor3473f882001-02-23 17:55:21 +0000320#define CAST_TO_BOOLEAN \
321 if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
322 xmlXPathBooleanFunction(ctxt, 1);
323
324/*
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000325 * Variable Lookup forwarding
Owen Taylor3473f882001-02-23 17:55:21 +0000326 */
Daniel Veillard5e2dace2001-07-18 19:30:27 +0000327typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
Owen Taylor3473f882001-02-23 17:55:21 +0000328 const xmlChar *name,
329 const xmlChar *ns_uri);
330
331void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
332 xmlXPathVariableLookupFunc f,
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000333 void *data);
Owen Taylor3473f882001-02-23 17:55:21 +0000334
335/*
Thomas Broyerba4ad322001-07-26 16:55:21 +0000336 * Function Lookup forwarding
337 */
338typedef xmlXPathFunction
339 (*xmlXPathFuncLookupFunc) (void *ctxt,
340 const xmlChar *name,
341 const xmlChar *ns_uri);
342
343void xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
344 xmlXPathFuncLookupFunc f,
345 void *funcCtxt);
346
347/*
Owen Taylor3473f882001-02-23 17:55:21 +0000348 * Error reporting
349 */
350void xmlXPatherror (xmlXPathParserContextPtr ctxt,
351 const char *file,
352 int line,
353 int no);
354
355void xmlXPathDebugDumpObject (FILE *output,
356 xmlXPathObjectPtr cur,
357 int depth);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000358void xmlXPathDebugDumpCompExpr(FILE *output,
359 xmlXPathCompExprPtr comp,
360 int depth);
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000361
362/**
363 * NodeSet handling
364 */
Thomas Broyerf186c822001-07-31 23:30:37 +0000365int xmlXPathNodeSetContains (xmlNodeSetPtr cur,
366 xmlNodePtr val);
Thomas Broyerf06a3d82001-07-16 04:52:57 +0000367xmlNodeSetPtr xmlXPathDifference (xmlNodeSetPtr nodes1,
368 xmlNodeSetPtr nodes2);
369xmlNodeSetPtr xmlXPathIntersection (xmlNodeSetPtr nodes1,
370 xmlNodeSetPtr nodes2);
371
372xmlNodeSetPtr xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
373xmlNodeSetPtr xmlXPathDistinct (xmlNodeSetPtr nodes);
374
375int xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
376 xmlNodeSetPtr nodes2);
377
378xmlNodeSetPtr xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
379 xmlNodePtr node);
380xmlNodeSetPtr xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
381 xmlNodeSetPtr nodes2);
382xmlNodeSetPtr xmlXPathNodeLeading (xmlNodeSetPtr nodes,
383 xmlNodePtr node);
384xmlNodeSetPtr xmlXPathLeading (xmlNodeSetPtr nodes1,
385 xmlNodeSetPtr nodes2);
386
387xmlNodeSetPtr xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
388 xmlNodePtr node);
389xmlNodeSetPtr xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
390 xmlNodeSetPtr nodes2);
391xmlNodeSetPtr xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
392 xmlNodePtr node);
393xmlNodeSetPtr xmlXPathTrailing (xmlNodeSetPtr nodes1,
394 xmlNodeSetPtr nodes2);
395
396
Owen Taylor3473f882001-02-23 17:55:21 +0000397/**
398 * Extending a context
399 */
400
401int xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
402 const xmlChar *prefix,
403 const xmlChar *ns_uri);
404const xmlChar * xmlXPathNsLookup (xmlXPathContextPtr ctxt,
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000405 const xmlChar *prefix);
Owen Taylor3473f882001-02-23 17:55:21 +0000406void xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
407
408int xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
409 const xmlChar *name,
410 xmlXPathFunction f);
411int xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
412 const xmlChar *name,
413 const xmlChar *ns_uri,
414 xmlXPathFunction f);
415int xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
416 const xmlChar *name,
417 xmlXPathObjectPtr value);
418int xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
419 const xmlChar *name,
420 const xmlChar *ns_uri,
421 xmlXPathObjectPtr value);
422xmlXPathFunction xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
423 const xmlChar *name);
424xmlXPathFunction xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
425 const xmlChar *name,
426 const xmlChar *ns_uri);
427void xmlXPathRegisteredFuncsCleanup(xmlXPathContextPtr ctxt);
428xmlXPathObjectPtr xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
429 const xmlChar *name);
430xmlXPathObjectPtr xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
431 const xmlChar *name,
432 const xmlChar *ns_uri);
433void xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
434
435/**
436 * Utilities to extend XPath
437 */
438xmlXPathParserContextPtr
439 xmlXPathNewParserContext (const xmlChar *str,
440 xmlXPathContextPtr ctxt);
441void xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
442
443/* TODO: remap to xmlXPathValuePop and Push */
444xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt);
445int valuePush (xmlXPathParserContextPtr ctxt,
446 xmlXPathObjectPtr value);
447
448xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val);
449xmlXPathObjectPtr xmlXPathNewCString (const char *val);
Daniel Veillardba0b8c92001-05-15 09:43:47 +0000450xmlXPathObjectPtr xmlXPathWrapString (xmlChar *val);
451xmlXPathObjectPtr xmlXPathWrapCString (char *val);
Owen Taylor3473f882001-02-23 17:55:21 +0000452xmlXPathObjectPtr xmlXPathNewFloat (double val);
453xmlXPathObjectPtr xmlXPathNewBoolean (int val);
454xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val);
455xmlXPathObjectPtr xmlXPathNewValueTree (xmlNodePtr val);
456void xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
457 xmlNodePtr val);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000458void xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
459 xmlNodePtr val);
460void xmlXPathNodeSetSort (xmlNodeSetPtr set);
Owen Taylor3473f882001-02-23 17:55:21 +0000461
462void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt,
463 int nargs);
464void xmlXPathRoot (xmlXPathParserContextPtr ctxt);
465void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
466xmlChar * xmlXPathParseName (xmlXPathParserContextPtr ctxt);
467xmlChar * xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
468
469/*
470 * Debug
471 */
472#ifdef LIBXML_DEBUG_ENABLED
Owen Taylor3473f882001-02-23 17:55:21 +0000473void xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth);
474#endif
475/*
476 * Existing functions
477 */
Daniel Veillard017b1082001-06-21 11:20:21 +0000478double xmlXPathStringEvalNumber(const xmlChar *str);
Owen Taylor3473f882001-02-23 17:55:21 +0000479int xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt,
480 xmlXPathObjectPtr res);
481void xmlXPathInit(void);
482void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
483void xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt);
484xmlNodeSetPtr xmlXPathNodeSetCreate(xmlNodePtr val);
485void xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val);
486xmlNodeSetPtr xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2);
487void xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val);
488void xmlXPathNodeSetRemove(xmlNodeSetPtr cur, int val);
489void xmlXPathFreeNodeSet(xmlNodeSetPtr obj);
490xmlXPathObjectPtr xmlXPathNewNodeSet(xmlNodePtr val);
491xmlXPathObjectPtr xmlXPathNewNodeSetList(xmlNodeSetPtr val);
492xmlXPathObjectPtr xmlXPathWrapNodeSet(xmlNodeSetPtr val);
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000493xmlXPathObjectPtr xmlXPathWrapExternal(void *val);
Owen Taylor3473f882001-02-23 17:55:21 +0000494void xmlXPathFreeNodeSetList(xmlXPathObjectPtr obj);
495
496
497xmlXPathObjectPtr xmlXPathNewFloat(double val);
498xmlXPathObjectPtr xmlXPathNewBoolean(int val);
499xmlXPathObjectPtr xmlXPathNewString(const xmlChar *val);
500xmlXPathObjectPtr xmlXPathNewCString(const char *val);
501void xmlXPathFreeObject(xmlXPathObjectPtr obj);
502xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr doc);
503void xmlXPathFreeContext(xmlXPathContextPtr ctxt);
504
505int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
506int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
507void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
508void xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
509void xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
510void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
511void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
512void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
513
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000514int xmlXPathIsNodeType(const xmlChar *name);
Owen Taylor3473f882001-02-23 17:55:21 +0000515
516/*
517 * Some of the axis navigation routines
518 */
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000519xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
520 xmlNodePtr cur);
521xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
522 xmlNodePtr cur);
523xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
524 xmlNodePtr cur);
525xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
526 xmlNodePtr cur);
527xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
528 xmlNodePtr cur);
529xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
530 xmlNodePtr cur);
531xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
532 xmlNodePtr cur);
533xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
534 xmlNodePtr cur);
535xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
536 xmlNodePtr cur);
537xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
538 xmlNodePtr cur);
539xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
540 xmlNodePtr cur);
541xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
542 xmlNodePtr cur);
543xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
544 xmlNodePtr cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000545/*
546 * The official core of XPath functions
547 */
548void xmlXPathRoot(xmlXPathParserContextPtr ctxt);
549void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
550void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
551void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
552void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
553void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
554void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
555void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
556void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
557void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
558void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
559void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
560void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
561void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
562void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
563void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
564void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
565void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
566void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
567void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
568void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
569void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
570void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
571void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
572void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
573void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
574void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
575#ifdef __cplusplus
576}
577#endif
578#endif /* ! __XML_XPATH_INTERNALS_H__ */