libxml2

Loading...
Searching...
No Matches
Macros | Functions
xpathInternals.h File Reference

internal interfaces for XML Path Language implementation More...

## Macros
#define | valuePush xmlXPathValuePush
| Push a value on the stack.
#define | valuePop xmlXPathValuePop
| Pop a value from the stack.
#define | xmlXPathSetError(ctxt, err)
| Raises an error.
#define | xmlXPathSetArityError(ctxt)
| Raises an XPATH_INVALID_ARITY error.
#define | xmlXPathSetTypeError(ctxt)
| Raises an XPATH_INVALID_TYPE error.
#define | xmlXPathGetError(ctxt)
| Get the error code of an XPath context.
#define | xmlXPathCheckError(ctxt)
| Check if an XPath error was raised.
#define | xmlXPathGetDocument(ctxt)
| Get the document of an XPath context.
#define | xmlXPathGetContextNode(ctxt)
| Get the context node of an XPath context.
#define | xmlXPathReturnBoolean(ctxt, val)
| Pushes the boolean val on the context stack.
#define | xmlXPathReturnTrue(ctxt)
| Pushes true on the context stack.
#define | xmlXPathReturnFalse(ctxt)
| Pushes false on the context stack.
#define | xmlXPathReturnNumber(ctxt, val)
| Pushes the double val on the context stack.
#define | xmlXPathReturnString(ctxt, str)
| Pushes the string str on the context stack.
#define | xmlXPathReturnEmptyString(ctxt)
| Pushes an empty string on the stack.
#define | xmlXPathReturnNodeSet(ctxt, ns)
| Pushes the node-set ns on the context stack.
#define | xmlXPathReturnEmptyNodeSet(ctxt)
| Pushes an empty node-set on the context stack.
#define | xmlXPathReturnExternal(ctxt, val)
| Pushes user data on the context stack.
#define | xmlXPathStackIsNodeSet(ctxt)
| Check if the current value on the XPath stack is a node set or an XSLT value tree.
#define | xmlXPathStackIsExternal(ctxt)
| Checks if the current value on the XPath stack is an external object.
#define | xmlXPathEmptyNodeSet(ns)
| Empties a node-set.
#define | CHECK_ERROR if (ctxt->error != XPATH_EXPRESSION_OK) return
| Macro to return from the function if an XPath error was detected.
#define | CHECK_ERROR0 if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
| Macro to return 0 from the function if an XPath error was detected.
#define | XP_ERROR(X)
| Macro to raise an XPath error and return.
#define | XP_ERROR0(X)
| Macro to raise an XPath error and return 0.
#define | CHECK_TYPE(typeval)
| Macro to check that the value on top of the XPath stack is of a given type.
#define | CHECK_TYPE0(typeval)
| Macro to check that the value on top of the XPath stack is of a given type.
#define | CHECK_ARITY(x)
| Macro to check that the number of args passed to an XPath function matches.
#define | CAST_TO_STRING
| Macro to try to cast the value on the top of the XPath stack to a string.
#define | CAST_TO_NUMBER
| Macro to try to cast the value on the top of the XPath stack to a number.
#define | CAST_TO_BOOLEAN
| Macro to try to cast the value on the top of the XPath stack to a boolean.

## Functions
int | xmlXPathPopBoolean (xmlXPathParserContext *ctxt)
| Pops a boolean from the stack, handling conversion if needed.
double | xmlXPathPopNumber (xmlXPathParserContext *ctxt)
| Pops a number from the stack, handling conversion if needed.
xmlChar * | xmlXPathPopString (xmlXPathParserContext *ctxt)
| Pops a string from the stack, handling conversion if needed.
xmlNodeSet * | xmlXPathPopNodeSet (xmlXPathParserContext *ctxt)
| Pops a node-set from the stack, handling conversion if needed.
void * | xmlXPathPopExternal (xmlXPathParserContext *ctxt)
| Pops an external object from the stack, handling conversion if needed.
void | xmlXPathRegisterVariableLookup (xmlXPathContext *ctxt, xmlXPathVariableLookupFunc f, void *data)
| register an external mechanism to do variable lookup
void | xmlXPathRegisterFuncLookup (xmlXPathContext *ctxt, xmlXPathFuncLookupFunc f, void *funcCtxt)
| Registers an external mechanism to do function lookup.
void | xmlXPatherror (xmlXPathParserContext *ctxt, const char *file, int line, int no)
| Formats an error message.
void | xmlXPathErr (xmlXPathParserContext *ctxt, int error)
| Handle an XPath error.
void | xmlXPathDebugDumpObject (FILE *output, xmlXPathObject *cur, int depth)
| Dump the content of the object for debugging purposes.
void | xmlXPathDebugDumpCompExpr (FILE *output, xmlXPathCompExpr *comp, int depth)
| Dumps the tree of the compiled XPath expression.
int | xmlXPathNodeSetContains (xmlNodeSet *cur, xmlNode *val)
| NodeSet handling.
xmlNodeSet * | xmlXPathDifference (xmlNodeSet *nodes1, xmlNodeSet *nodes2)
| Implements the EXSLT - Sets difference() function: node-set set:difference (node-set, node-set).
xmlNodeSet * | xmlXPathIntersection (xmlNodeSet *nodes1, xmlNodeSet *nodes2)
| Implements the EXSLT - Sets intersection() function: node-set set:intersection (node-set, node-set).
xmlNodeSet * | xmlXPathDistinctSorted (xmlNodeSet *nodes)
| Implements the EXSLT - Sets distinct() function: node-set set:distinct (node-set).
xmlNodeSet * | xmlXPathDistinct (xmlNodeSet *nodes)
| Implements the EXSLT - Sets distinct() function: node-set set:distinct (node-set) nodes is sorted by document order, then exslSetsDistinctSorted is called with the sorted node-set.
int | xmlXPathHasSameNodes (xmlNodeSet *nodes1, xmlNodeSet *nodes2)
| Implements the EXSLT - Sets has-same-nodes function: boolean set:has-same-node(node-set, node-set).
xmlNodeSet * | xmlXPathNodeLeadingSorted (xmlNodeSet *nodes, xmlNode *node)
| Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set).
xmlNodeSet * | xmlXPathLeadingSorted (xmlNodeSet *nodes1, xmlNodeSet *nodes2)
| Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set).
xmlNodeSet * | xmlXPathNodeLeading (xmlNodeSet *nodes, xmlNode *node)
| Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set) nodes is sorted by document order, then exslSetsNodeLeadingSorted is called.
xmlNodeSet * | xmlXPathLeading (xmlNodeSet *nodes1, xmlNodeSet *nodes2)
| Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set) nodes1 and nodes2 are sorted by document order, then exslSetsLeadingSorted is called.
xmlNodeSet * | xmlXPathNodeTrailingSorted (xmlNodeSet *nodes, xmlNode *node)
| Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set).
xmlNodeSet * | xmlXPathTrailingSorted (xmlNodeSet *nodes1, xmlNodeSet *nodes2)
| Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set).
xmlNodeSet * | xmlXPathNodeTrailing (xmlNodeSet *nodes, xmlNode *node)
| Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set) nodes is sorted by document order, then xmlXPathNodeTrailingSorted is called.
xmlNodeSet * | xmlXPathTrailing (xmlNodeSet *nodes1, xmlNodeSet *nodes2)
| Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set) nodes1 and nodes2 are sorted by document order, then xmlXPathTrailingSorted is called.
int | xmlXPathRegisterNs (xmlXPathContext *ctxt, const xmlChar *prefix, const xmlChar *ns_uri)
| Extending a context.
const xmlChar * | xmlXPathNsLookup (xmlXPathContext *ctxt, const xmlChar *prefix)
| Search in the namespace declaration array of the context for the given namespace name associated to the given prefix.
void | xmlXPathRegisteredNsCleanup (xmlXPathContext *ctxt)
| Cleanup the XPath context data associated to registered variables.
int | xmlXPathRegisterFunc (xmlXPathContext *ctxt, const xmlChar *name, xmlXPathFunction f)
| Register a new function.
int | xmlXPathRegisterFuncNS (xmlXPathContext *ctxt, const xmlChar *name, const xmlChar *ns_uri, xmlXPathFunction f)
| Register a new function.
int | xmlXPathRegisterVariable (xmlXPathContext *ctxt, const xmlChar *name, xmlXPathObject *value)
| Register a new variable value.
int | xmlXPathRegisterVariableNS (xmlXPathContext *ctxt, const xmlChar *name, const xmlChar *ns_uri, xmlXPathObject *value)
| Register a new variable value.
xmlXPathFunction | xmlXPathFunctionLookup (xmlXPathContext *ctxt, const xmlChar *name)
| Search in the Function array of the context for the given function.
xmlXPathFunction | xmlXPathFunctionLookupNS (xmlXPathContext *ctxt, const xmlChar *name, const xmlChar *ns_uri)
| Search in the Function array of the context for the given function.
void | xmlXPathRegisteredFuncsCleanup (xmlXPathContext *ctxt)
| Cleanup the XPath context data associated to registered functions.
xmlXPathObject * | xmlXPathVariableLookup (xmlXPathContext *ctxt, const xmlChar *name)
| Search in the Variable array of the context for the given variable value.
xmlXPathObject * | xmlXPathVariableLookupNS (xmlXPathContext *ctxt, const xmlChar *name, const xmlChar *ns_uri)
| Search in the Variable array of the context for the given variable value.
void | xmlXPathRegisteredVariablesCleanup (xmlXPathContext *ctxt)
| Cleanup the XPath context data associated to registered variables.
xmlXPathParserContext * | xmlXPathNewParserContext (const xmlChar *str, xmlXPathContext *ctxt)
| Utilities to extend XPath.
void | xmlXPathFreeParserContext (xmlXPathParserContext *ctxt)
| Free up an xmlXPathParserContext.
xmlXPathObject * | xmlXPathValuePop (xmlXPathParserContext *ctxt)
| Pops the top XPath object from the value stack.
int | xmlXPathValuePush (xmlXPathParserContext *ctxt, xmlXPathObject *value)
| Pushes a new XPath object on top of the value stack.
xmlXPathObject * | xmlXPathNewString (const xmlChar *val)
| Create a new xmlXPathObject of type string and of value val.
xmlXPathObject * | xmlXPathNewCString (const char *val)
| Create a new xmlXPathObject of type string and of value val.
xmlXPathObject * | xmlXPathWrapString (xmlChar *val)
| Wraps the val string into an XPath object.
xmlXPathObject * | xmlXPathWrapCString (char *val)
| Wraps a string into an XPath object.
xmlXPathObject * | xmlXPathNewFloat (double val)
| Create a new xmlXPathObject of type double and of value val.
xmlXPathObject * | xmlXPathNewBoolean (int val)
| Create a new xmlXPathObject of type boolean and of value val.
xmlXPathObject * | xmlXPathNewNodeSet (xmlNode *val)
| Create a new xmlXPathObject of type NodeSet and initialize it with the single Node val.
xmlXPathObject * | xmlXPathNewValueTree (xmlNode *val)
| Create a new xmlXPathObject of type Value Tree (XSLT) and initialize it with the tree root val.
int | xmlXPathNodeSetAdd (xmlNodeSet *cur, xmlNode *val)
| add a new xmlNode to an existing NodeSet
int | xmlXPathNodeSetAddUnique (xmlNodeSet *cur, xmlNode *val)
| add a new xmlNode to an existing NodeSet, optimized version when we are sure the node is not already in the set.
int | xmlXPathNodeSetAddNs (xmlNodeSet *cur, xmlNode *node, xmlNs *ns)
| add a new namespace node to an existing NodeSet
void | xmlXPathNodeSetSort (xmlNodeSet *set)
| Sort the node set in document order.
void | xmlXPathRoot (xmlXPathParserContext *ctxt)
| Initialize the context to the root of the document.
void | xmlXPathEvalExpr (xmlXPathParserContext *ctxt)
| Parse and evaluate an XPath expression in the given context, then push the result on the context stack.
xmlChar * | xmlXPathParseName (xmlXPathParserContext *ctxt)
| parse an XML name
xmlChar * | xmlXPathParseNCName (xmlXPathParserContext *ctxt)
| Parse an XML non-colonized name.
double | xmlXPathStringEvalNumber (const xmlChar *str)
| [30a] Float ::= Number ('e' Digits?)?
int | xmlXPathEvaluatePredicateResult (xmlXPathParserContext *ctxt, xmlXPathObject *res)
| Evaluate a predicate result for the current node.
void | xmlXPathRegisterAllFunctions (xmlXPathContext *ctxt)
| Registers all default XPath functions in this context.
xmlNodeSet * | xmlXPathNodeSetMerge (xmlNodeSet *val1, xmlNodeSet *val2)
| Merges two nodesets, all nodes from val2 are added to val1 if val1 is NULL, a new set is created and copied from val2.
void | xmlXPathNodeSetDel (xmlNodeSet *cur, xmlNode *val)
| Removes an xmlNode from an existing NodeSet.
void | xmlXPathNodeSetRemove (xmlNodeSet *cur, int val)
| Removes an entry from an existing NodeSet list.
xmlXPathObject * | xmlXPathNewNodeSetList (xmlNodeSet *val)
| Create a new xmlXPathObject of type NodeSet and initialize it with the Nodeset val.
xmlXPathObject * | xmlXPathWrapNodeSet (xmlNodeSet *val)
| Wrap the Nodeset val in a new xmlXPathObject.
xmlXPathObject * | xmlXPathWrapExternal (void *val)
| Wraps the val data into an XPath object.
int | xmlXPathEqualValues (xmlXPathParserContext *ctxt)
| Implement the equal operation on XPath objects content: arg1 == arg2.
int | xmlXPathNotEqualValues (xmlXPathParserContext *ctxt)
| Implement the equal operation on XPath objects content: arg1 == arg2.
int | xmlXPathCompareValues (xmlXPathParserContext *ctxt, int inf, int strict)
| Implement the compare operation on XPath objects: arg1 < arg2 (1, 1, ... arg1 <= arg2 (1, 0, ... arg1 > arg2 (0, 1, ... arg1 >= arg2 (0, 0, ...
void | xmlXPathValueFlipSign (xmlXPathParserContext *ctxt)
| Implement the unary - operation on an XPath object The numeric operators convert their operands to numbers as if by calling the number function.
void | xmlXPathAddValues (xmlXPathParserContext *ctxt)
| Implement the add operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.
void | xmlXPathSubValues (xmlXPathParserContext *ctxt)
| Implement the subtraction operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.
void | xmlXPathMultValues (xmlXPathParserContext *ctxt)
| Implement the multiply operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.
void | xmlXPathDivValues (xmlXPathParserContext *ctxt)
| Implement the div operation on XPath objects arg1 / arg2.
void | xmlXPathModValues (xmlXPathParserContext *ctxt)
| Implement the mod operation on XPath objects: arg1 / arg2 The numeric operators convert their operands to numbers as if by calling the number function.
int | xmlXPathIsNodeType (const xmlChar *name)
| Is the name given a NodeType one.
xmlNode * | xmlXPathNextSelf (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "self" direction The self axis contains just the context node itself.
xmlNode * | xmlXPathNextChild (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "child" direction The child axis contains the children of the context node in document order.
xmlNode * | xmlXPathNextDescendant (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "descendant" direction the descendant axis contains the descendants of the context node in document order; a descendant is a child or a child of a child and so on.
xmlNode * | xmlXPathNextDescendantOrSelf (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "descendant-or-self" direction the descendant-or-self axis contains the context node and the descendants of the context node in document order; thus the context node is the first node on the axis, and the first child of the context node is the second node on the axis.
xmlNode * | xmlXPathNextParent (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "parent" direction The parent axis contains the parent of the context node, if there is one.
xmlNode * | xmlXPathNextAncestorOrSelf (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "ancestor-or-self" direction he ancestor-or-self axis contains the context node and ancestors of the context node in reverse document order; thus the context node is the first node on the axis, and the context node's parent the second; parent here is defined the same as with the parent axis.
xmlNode * | xmlXPathNextFollowingSibling (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "following-sibling" direction The following-sibling axis contains the following siblings of the context node in document order.
xmlNode * | xmlXPathNextFollowing (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "following" direction The following axis contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes and namespace nodes; the nodes are ordered in document order.
xmlNode * | xmlXPathNextNamespace (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "namespace" direction the namespace axis contains the namespace nodes of the context node; the order of nodes on this axis is implementation-defined; the axis will be empty unless the context node is an element.
xmlNode * | xmlXPathNextAttribute (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "attribute" direction TODO: support DTD inherited default attributes.
xmlNode * | xmlXPathNextPreceding (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "preceding" direction the preceding axis contains all nodes in the same document as the context node that are before the context node in document order, excluding any ancestors and excluding attribute nodes and namespace nodes; the nodes are ordered in reverse document order.
xmlNode * | xmlXPathNextAncestor (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "ancestor" direction the ancestor axis contains the ancestors of the context node; the ancestors of the context node consist of the parent of context node and the parent's parent and so on; the nodes are ordered in reverse document order; thus the parent is the first node on the axis, and the parent's parent is the second node on the axis.
xmlNode * | xmlXPathNextPrecedingSibling (xmlXPathParserContext *ctxt, xmlNode *cur)
| Traversal function for the "preceding-sibling" direction The preceding-sibling axis contains the preceding siblings of the context node in reverse document order; the first preceding sibling is first on the axis; the sibling preceding that node is the second on the axis and so on.
void | xmlXPathLastFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the last() XPath function number last() The last function returns the number of nodes in the context node list.
void | xmlXPathPositionFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the position() XPath function number position() The position function returns the position of the context node in the context node list.
void | xmlXPathCountFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the count() XPath function number count(node-set).
void | xmlXPathIdFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the id() XPath function node-set id(object) The id function selects elements by their unique ID (see [5.2.1 Unique IDs]).
void | xmlXPathLocalNameFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the local-name() XPath function string local-name(node-set?) The local-name function returns a string containing the local part of the name of the node in the argument node-set that is first in document order.
void | xmlXPathNamespaceURIFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the namespace-uri() XPath function string namespace-uri(node-set?) The namespace-uri function returns a string containing the namespace URI of the expanded name of the node in the argument node-set that is first in document order.
void | xmlXPathStringFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the string() XPath function string string(object?) The string function converts an object to a string as follows:
void | xmlXPathStringLengthFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the string-length() XPath function number string-length(string?) The string-length returns the number of characters in the string (see [3.6 Strings]).
void | xmlXPathConcatFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the concat() XPath function string concat(string, string, string*) The concat function returns the concatenation of its arguments.
void | xmlXPathContainsFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the contains() XPath function boolean contains(string, string) The contains function returns true if the first argument string contains the second argument string, and otherwise returns false.
void | xmlXPathStartsWithFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the starts-with() XPath function boolean starts-with(string, string) The starts-with function returns true if the first argument string starts with the second argument string, and otherwise returns false.
void | xmlXPathSubstringFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the substring() XPath function string substring(string, number, number?) The substring function returns the substring of the first argument starting at the position specified in the second argument with length specified in the third argument.
void | xmlXPathSubstringBeforeFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the substring-before() XPath function string substring-before(string, string) The substring-before function returns the substring of the first argument string that precedes the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string.
void | xmlXPathSubstringAfterFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the substring-after() XPath function string substring-after(string, string) The substring-after function returns the substring of the first argument string that follows the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string.
void | xmlXPathNormalizeFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the normalize-space() XPath function string normalize-space(string?) The normalize-space function returns the argument string with white space normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space.
void | xmlXPathTranslateFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the translate() XPath function string translate(string, string, string) The translate function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string.
void | xmlXPathNotFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the not() XPath function boolean not(boolean) The not function returns true if its argument is false, and false otherwise.
void | xmlXPathTrueFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the true() XPath function boolean true().
void | xmlXPathFalseFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the false() XPath function boolean false().
void | xmlXPathLangFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the lang() XPath function boolean lang(string) The lang function returns true or false depending on whether the language of the context node as specified by xml:lang attributes is the same as or is a sublanguage of the language specified by the argument string.
void | xmlXPathNumberFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the number() XPath function number number(object?).
void | xmlXPathSumFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the sum() XPath function number sum(node-set) The sum function returns the sum of the values of the nodes in the argument node-set.
void | xmlXPathFloorFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the floor() XPath function number floor(number) The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer.
void | xmlXPathCeilingFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the ceiling() XPath function number ceiling(number) The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer.
void | xmlXPathRoundFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the round() XPath function number round(number) The round function returns the number that is closest to the argument and that is an integer.
void | xmlXPathBooleanFunction (xmlXPathParserContext *ctxt, int nargs)
| Implement the boolean() XPath function boolean boolean(object) The boolean function converts its argument to a boolean as follows:
void | xmlXPathNodeSetFreeNs (xmlNs *ns)
| Really internal functions.

## Detailed Description

internal interfaces for XML Path Language implementation

internal interfaces for XML Path Language implementation used to build new modules on top of XPath like XPointer and XSLT

Copyright
  See Copyright for the status of this software.

Author
  Daniel Veillard

## Macro Definition Documentation

## ◆ CHECK_ARITY

#define CHECK_ARITY | ( |  | x | ) |

Value:
if (ctxt == NULL) return; \
if (nargs != (x)) \
XP_ERROR(XPATH_INVALID_ARITY); \
if (ctxt->valueNr < (x)) \
XP_ERROR(XPATH_STACK_ERROR);

Macro to check that the number of args passed to an XPath function matches.

Parameters

  x | the number of expected args

## ◆ CHECK_TYPE

#define CHECK_TYPE | ( |  | typeval | ) |

Value:
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
XP_ERROR(XPATH_INVALID_TYPE)

Macro to check that the value on top of the XPath stack is of a given type.

Parameters

  typeval | the XPath type

## ◆ CHECK_TYPE0

#define CHECK_TYPE0 | ( |  | typeval | ) |

Value:
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
XP_ERROR0(XPATH_INVALID_TYPE)

Macro to check that the value on top of the XPath stack is of a given type.

Return(0) in case of failure

Parameters

  typeval | the XPath type

## ◆ valuePop

#define valuePop xmlXPathValuePop

Pop a value from the stack.

Deprecated
  Use xmlXPathValuePop

## ◆ valuePush

#define valuePush xmlXPathValuePush

Push a value on the stack.

Deprecated
  Use xmlXPathValuePush

## ◆ xmlXPathCheckError

#define xmlXPathCheckError | ( |  | ctxt | ) |

Value:
((ctxt)->error != XPATH_EXPRESSION_OK)

Check if an XPath error was raised.

Parameters

  ctxt | an XPath parser context

Returns
  true if an error has been raised, false otherwise.

## ◆ xmlXPathEmptyNodeSet

#define xmlXPathEmptyNodeSet | ( |  | ns | ) |

Value:
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; }

Empties a node-set.

Parameters

  ns | a node-set

## ◆ xmlXPathGetContextNode

#define xmlXPathGetContextNode | ( |  | ctxt | ) |

Value:
((ctxt)->context->node)

Get the context node of an XPath context.

Parameters

  ctxt | an XPath parser context

Returns
  the context node.

## ◆ xmlXPathGetDocument

#define xmlXPathGetDocument | ( |  | ctxt | ) |

Value:
((ctxt)->context->doc)

Get the document of an XPath context.

Parameters

  ctxt | an XPath parser context

Returns
  the context document.

## ◆ xmlXPathGetError

#define xmlXPathGetError | ( |  | ctxt | ) |

Value:
((ctxt)->error)

Get the error code of an XPath context.

Parameters

  ctxt | an XPath parser context

Returns
  the context error.

## ◆ xmlXPathReturnBoolean

#define xmlXPathReturnBoolean | ( |  | ctxt,
|  |  | val )

Value:
valuePush((ctxt), xmlXPathNewBoolean(val))
valuePush
#define valuePush
Push a value on the stack.
Definition xpathInternals.h:33
xmlXPathNewBoolean
xmlXPathObject * xmlXPathNewBoolean(int val)
Create a new xmlXPathObject of type boolean and of value val.
Definition xpath.c:4075

Pushes the boolean val on the context stack.

Parameters

  ctxt | an XPath parser context
  val | a boolean

## ◆ xmlXPathReturnEmptyNodeSet

#define xmlXPathReturnEmptyNodeSet | ( |  | ctxt | ) |

Value:
valuePush((ctxt), xmlXPathNewNodeSet(NULL))
xmlXPathNewNodeSet
xmlXPathObject * xmlXPathNewNodeSet(xmlNode *val)
Create a new xmlXPathObject of type NodeSet and initialize it with the single Node val.
Definition xpath.c:3191

Pushes an empty node-set on the context stack.

Parameters

  ctxt | an XPath parser context

## ◆ xmlXPathReturnEmptyString

#define xmlXPathReturnEmptyString | ( |  | ctxt | ) |

Value:
valuePush((ctxt), xmlXPathNewCString(""))
xmlXPathNewCString
xmlXPathObject * xmlXPathNewCString(const char *val)
Create a new xmlXPathObject of type string and of value val.
Definition xpath.c:4142

Pushes an empty string on the stack.

Parameters

  ctxt | an XPath parser context

## ◆ xmlXPathReturnExternal

#define xmlXPathReturnExternal | ( |  | ctxt,
|  |  | val )

Value:
valuePush((ctxt), xmlXPathWrapExternal(val))
xmlXPathWrapExternal
xmlXPathObject * xmlXPathWrapExternal(void *val)
Wraps the val data into an XPath object.
Definition xpath.c:4164

Pushes user data on the context stack.

Parameters

  ctxt | an XPath parser context
  val | user data

## ◆ xmlXPathReturnFalse

#define xmlXPathReturnFalse | ( |  | ctxt | ) |

Value:
xmlXPathReturnBoolean((ctxt), 0)
xmlXPathReturnBoolean
#define xmlXPathReturnBoolean(ctxt, val)
Pushes the boolean val on the context stack.
Definition xpathInternals.h:126

Pushes false on the context stack.

Parameters

  ctxt | an XPath parser context

## ◆ xmlXPathReturnNodeSet

#define xmlXPathReturnNodeSet | ( |  | ctxt,
|  |  | ns )

Value:
valuePush((ctxt), xmlXPathWrapNodeSet(ns))
xmlXPathWrapNodeSet
xmlXPathObject * xmlXPathWrapNodeSet(xmlNodeSet *val)
Wrap the Nodeset val in a new xmlXPathObject.
Definition xpath.c:3267

Pushes the node-set ns on the context stack.

Parameters

  ctxt | an XPath parser context
  ns | a node-set

## ◆ xmlXPathReturnNumber

#define xmlXPathReturnNumber | ( |  | ctxt,
|  |  | val )

Value:
valuePush((ctxt), xmlXPathNewFloat(val))
xmlXPathNewFloat
xmlXPathObject * xmlXPathNewFloat(double val)
Create a new xmlXPathObject of type double and of value val.
Definition xpath.c:4056

Pushes the double val on the context stack.

Parameters

  ctxt | an XPath parser context
  val | a double

## ◆ xmlXPathReturnString

#define xmlXPathReturnString | ( |  | ctxt,
|  |  | str )

Value:
valuePush((ctxt), xmlXPathWrapString(str))
xmlXPathWrapString
xmlXPathObject * xmlXPathWrapString(xmlChar *val)
Wraps the val string into an XPath object.
Definition xpath.c:4121

Pushes the string str on the context stack.

Parameters

  ctxt | an XPath parser context
  str | a string

## ◆ xmlXPathReturnTrue

#define xmlXPathReturnTrue | ( |  | ctxt | ) |

Value:
xmlXPathReturnBoolean((ctxt), 1)

Pushes true on the context stack.

Parameters

  ctxt | an XPath parser context

## ◆ xmlXPathSetArityError

#define xmlXPathSetArityError | ( |  | ctxt | ) |

Value:
xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
xmlXPathSetError
#define xmlXPathSetError(ctxt, err)
Raises an error.
Definition xpathInternals.h:57

Raises an XPATH_INVALID_ARITY error.

Parameters

  ctxt | an XPath parser context

## ◆ xmlXPathSetError

#define xmlXPathSetError | ( |  | ctxt,
|  |  | err )

Value:
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
if ((ctxt) != NULL) (ctxt)->error = (err); }
xmlXPatherror
void xmlXPatherror(xmlXPathParserContext *ctxt, const char *file, int line, int no)
Formats an error message.
Definition xpath.c:790

Raises an error.

Parameters

  ctxt | an XPath parser context
  err | an xmlXPathError code

## ◆ xmlXPathSetTypeError

#define xmlXPathSetTypeError | ( |  | ctxt | ) |

Value:
xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)

Raises an XPATH_INVALID_TYPE error.

Parameters

  ctxt | an XPath parser context

## ◆ xmlXPathStackIsExternal

#define xmlXPathStackIsExternal | ( |  | ctxt | ) |

Value:
((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))

Checks if the current value on the XPath stack is an external object.

Parameters

  ctxt | an XPath parser context

Returns
  true if the current object on the stack is an external object.

## ◆ xmlXPathStackIsNodeSet

#define xmlXPathStackIsNodeSet | ( |  | ctxt | ) |

Value:
(((ctxt)->value != NULL) \
&& (((ctxt)->value->type == XPATH_NODESET) \
|| ((ctxt)->value->type == XPATH_XSLT_TREE)))

Check if the current value on the XPath stack is a node set or an XSLT value tree.

Parameters

  ctxt | an XPath parser context

Returns
  true if the current object on the stack is a node-set.

## ◆ XP_ERROR

#define XP_ERROR | ( |  | X | ) |

Value:
{ xmlXPathErr(ctxt, X); return; }
xmlXPathErr
void xmlXPathErr(xmlXPathParserContext *ctxt, int error)
Handle an XPath error.
Definition xpath.c:777

Macro to raise an XPath error and return.

Parameters

  X | the error code

## ◆ XP_ERROR0

#define XP_ERROR0 | ( |  | X | ) |

Value:
{ xmlXPathErr(ctxt, X); return(0); }

Macro to raise an XPath error and return 0.

Parameters

  X | the error code

## Function Documentation

## ◆ xmlXPathAddValues()

void xmlXPathAddValues | ( | xmlXPathParserContext * | ctxt | ) |

Implement the add operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.

Parameters

  ctxt | the XPath Parser context

## ◆ xmlXPathBooleanFunction()

void xmlXPathBooleanFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the boolean() XPath function boolean boolean(object) The boolean function converts its argument to a boolean as follows:

- a number is true if and only if it is neither positive or negative zero nor NaN
- a node-set is true if and only if it is non-empty
- a string is true if and only if its length is non-zero

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathCeilingFunction()

void xmlXPathCeilingFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the ceiling() XPath function number ceiling(number) The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathCompareValues()

int xmlXPathCompareValues | ( | xmlXPathParserContext * | ctxt,
|  | int | inf,
|  | int | strict )

Implement the compare operation on XPath objects: arg1 < arg2 (1, 1, ... arg1 <= arg2 (1, 0, ... arg1 > arg2 (0, 1, ... arg1 >= arg2 (0, 0, ...

When neither object to be compared is a node-set and the operator is <=, <, >=, >, then the objects are compared by converted both objects to numbers and comparing the numbers according to IEEE 754. The < comparison will be true if and only if the first number is less than the second number. The <= comparison will be true if and only if the first number is less than or equal to the second number. The > comparison will be true if and only if the first number is greater than the second number. The >= comparison will be true if and only if the first number is greater than or equal to the second number.

Parameters

  ctxt | the XPath Parser context
  inf | less than (1) or greater than (0)
  strict | is the comparison strict

Returns
  1 if the comparison succeeded, 0 if it failed

## ◆ xmlXPathConcatFunction()

void xmlXPathConcatFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the concat() XPath function string concat(string, string, string*) The concat function returns the concatenation of its arguments.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathContainsFunction()

void xmlXPathContainsFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the contains() XPath function boolean contains(string, string) The contains function returns true if the first argument string contains the second argument string, and otherwise returns false.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathCountFunction()

void xmlXPathCountFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the count() XPath function number count(node-set).

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathDebugDumpCompExpr()

void xmlXPathDebugDumpCompExpr | ( | FILE * | output,
|  | xmlXPathCompExpr * | comp,
|  | int | depth )

Dumps the tree of the compiled XPath expression.

Parameters

  output | the FILE * for the output
  comp | the precompiled XPath expression
  depth | the indentation level.

## ◆ xmlXPathDebugDumpObject()

void xmlXPathDebugDumpObject | ( | FILE * | output,
|  | xmlXPathObject * | cur,
|  | int | depth )

Dump the content of the object for debugging purposes.

Parameters

  output | the FILE * to dump the output
  cur | the object to inspect
  depth | indentation level

## ◆ xmlXPathDifference()

xmlNodeSet * xmlXPathDifference | ( | xmlNodeSet * | nodes1,
|  | xmlNodeSet * | nodes2 )

Implements the EXSLT - Sets difference() function: node-set set:difference (node-set, node-set).

Parameters

  nodes1 | a node-set
  nodes2 | a node-set

Returns
  the difference between the two node sets, or nodes1 if nodes2 is empty

## ◆ xmlXPathDistinct()

xmlNodeSet * xmlXPathDistinct | ( | xmlNodeSet * | nodes | ) |

Implements the EXSLT - Sets distinct() function: node-set set:distinct (node-set) nodes is sorted by document order, then exslSetsDistinctSorted is called with the sorted node-set.

Parameters

  nodes | a node-set

Returns
  a subset of the nodes contained in nodes, or nodes if it is empty

## ◆ xmlXPathDistinctSorted()

xmlNodeSet * xmlXPathDistinctSorted | ( | xmlNodeSet * | nodes | ) |

Implements the EXSLT - Sets distinct() function: node-set set:distinct (node-set).

Parameters

  nodes | a node-set, sorted by document order

Returns
  a subset of the nodes contained in nodes, or nodes if it is empty

## ◆ xmlXPathDivValues()

void xmlXPathDivValues | ( | xmlXPathParserContext * | ctxt | ) |

Implement the div operation on XPath objects arg1 / arg2.

The numeric operators convert their operands to numbers as if by calling the number function.

Parameters

  ctxt | the XPath Parser context

## ◆ xmlXPathEqualValues()

int xmlXPathEqualValues | ( | xmlXPathParserContext * | ctxt | ) |

Implement the equal operation on XPath objects content: arg1 == arg2.

Parameters

  ctxt | the XPath Parser context

Returns
  0 or 1 depending on the results of the test.

## ◆ xmlXPathErr()

void xmlXPathErr | ( | xmlXPathParserContext * | ctxt,
|  | int | code )

Handle an XPath error.

Parameters

  ctxt | a XPath parser context
  code | the error code

## ◆ xmlXPatherror()

void xmlXPatherror | ( | xmlXPathParserContext * | ctxt,
|  | const char * | file,
|  | int | line,
|  | int | no )

Formats an error message.

Parameters

  ctxt | the XPath Parser context
  file | the file name
  line | the line number
  no | the error number

## ◆ xmlXPathEvalExpr()

void xmlXPathEvalExpr | ( | xmlXPathParserContext * | ctxt | ) |

Parse and evaluate an XPath expression in the given context, then push the result on the context stack.

Deprecated
  Internal function, don't use.

Parameters

  ctxt | the XPath Parser context

## ◆ xmlXPathEvaluatePredicateResult()

int xmlXPathEvaluatePredicateResult | ( | xmlXPathParserContext * | ctxt,
|  | xmlXPathObject * | res )

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.

Parameters

  ctxt | the XPath Parser context
  res | the Predicate Expression evaluation result

Returns
  1 if predicate is true, 0 otherwise

## ◆ xmlXPathFalseFunction()

void xmlXPathFalseFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the false() XPath function boolean false().

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathFloorFunction()

void xmlXPathFloorFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the floor() XPath function number floor(number) The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathFreeParserContext()

void xmlXPathFreeParserContext | ( | xmlXPathParserContext * | ctxt | ) |

Free up an xmlXPathParserContext.

Parameters

  ctxt | the context to free

## ◆ xmlXPathFunctionLookup()

xmlXPathFunction xmlXPathFunctionLookup | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | name )

Search in the Function array of the context for the given function.

Parameters

  ctxt | the XPath context
  name | the function name

Returns
  the xmlXPathFunction or NULL if not found

## ◆ xmlXPathFunctionLookupNS()

xmlXPathFunction xmlXPathFunctionLookupNS | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | name,
|  | const xmlChar * | ns_uri )

Search in the Function array of the context for the given function.

Parameters

  ctxt | the XPath context
  name | the function name
  ns_uri | the function namespace URI

Returns
  the xmlXPathFunction or NULL if not found

## ◆ xmlXPathHasSameNodes()

int xmlXPathHasSameNodes | ( | xmlNodeSet * | nodes1,
|  | xmlNodeSet * | nodes2 )

Implements the EXSLT - Sets has-same-nodes function: boolean set:has-same-node(node-set, node-set).

Parameters

  nodes1 | a node-set
  nodes2 | a node-set

Returns
  true (1) if nodes1 shares any node with nodes2, false (0) otherwise

## ◆ xmlXPathIdFunction()

void xmlXPathIdFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the id() XPath function node-set id(object) The id function selects elements by their unique ID (see [5.2.1 Unique IDs]).

When the argument to id is of type node-set, then the result is the union of the result of applying id to the string value of each of the nodes in the argument node-set. When the argument to id is of any other type, the argument is converted to a string as if by a call to the string function; the string is split into a whitespace-separated list of tokens (whitespace is any sequence of characters matching the production S); the result is a node-set containing the elements in the same document as the context node that have a unique ID equal to any of the tokens in the list.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathIntersection()

xmlNodeSet * xmlXPathIntersection | ( | xmlNodeSet * | nodes1,
|  | xmlNodeSet * | nodes2 )

Implements the EXSLT - Sets intersection() function: node-set set:intersection (node-set, node-set).

Parameters

  nodes1 | a node-set
  nodes2 | a node-set

Returns
  a node set comprising the nodes that are within both the node sets passed as arguments

## ◆ xmlXPathIsNodeType()

int xmlXPathIsNodeType | ( | const xmlChar * | name | ) |

Is the name given a NodeType one.

[38] NodeType ::= 'comment' | 'text' | 'processing-instruction' | 'node'

Parameters

  name | a name string

Returns
  1 if true 0 otherwise

## ◆ xmlXPathLangFunction()

void xmlXPathLangFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the lang() XPath function boolean lang(string) The lang function returns true or false depending on whether the language of the context node as specified by xml:lang attributes is the same as or is a sublanguage of the language specified by the argument string.

The language of the context node is determined by the value of the xml:lang attribute on the context node, or, if the context node has no xml:lang attribute, by the value of the xml:lang attribute on the nearest ancestor of the context node that has an xml:lang attribute. If there is no such attribute, then lang returns false. If there is such an attribute, then lang returns true if the attribute value is equal to the argument ignoring case, or if there is some suffix starting with - such that the attribute value is equal to the argument ignoring that suffix of the attribute value and ignoring case.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathLastFunction()

void xmlXPathLastFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the last() XPath function number last() The last function returns the number of nodes in the context node list.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathLeading()

xmlNodeSet * xmlXPathLeading | ( | xmlNodeSet * | nodes1,
|  | xmlNodeSet * | nodes2 )

Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set) nodes1 and nodes2 are sorted by document order, then exslSetsLeadingSorted is called.

Parameters

  nodes1 | a node-set
  nodes2 | a node-set

Returns
  the nodes in nodes1 that precede the first node in nodes2 in document order, nodes1 if nodes2 is NULL or empty or an empty node-set if nodes1 doesn't contain nodes2

## ◆ xmlXPathLeadingSorted()

xmlNodeSet * xmlXPathLeadingSorted | ( | xmlNodeSet * | nodes1,
|  | xmlNodeSet * | nodes2 )

Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set).

Parameters

  nodes1 | a node-set, sorted by document order
  nodes2 | a node-set, sorted by document order

Returns
  the nodes in nodes1 that precede the first node in nodes2 in document order, nodes1 if nodes2 is NULL or empty or an empty node-set if nodes1 doesn't contain nodes2

## ◆ xmlXPathLocalNameFunction()

void xmlXPathLocalNameFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the local-name() XPath function string local-name(node-set?) The local-name function returns a string containing the local part of the name of the node in the argument node-set that is first in document order.

If the node-set is empty or the first node has no name, an empty string is returned. If the argument is omitted it defaults to the context node.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathModValues()

void xmlXPathModValues | ( | xmlXPathParserContext * | ctxt | ) |

Implement the mod operation on XPath objects: arg1 / arg2 The numeric operators convert their operands to numbers as if by calling the number function.

Parameters

  ctxt | the XPath Parser context

## ◆ xmlXPathMultValues()

void xmlXPathMultValues | ( | xmlXPathParserContext * | ctxt | ) |

Implement the multiply operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.

Parameters

  ctxt | the XPath Parser context

## ◆ xmlXPathNamespaceURIFunction()

void xmlXPathNamespaceURIFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the namespace-uri() XPath function string namespace-uri(node-set?) The namespace-uri function returns a string containing the namespace URI of the expanded name of the node in the argument node-set that is first in document order.

If the node-set is empty, the first node has no name, or the expanded name has no namespace URI, an empty string is returned. If the argument is omitted it defaults to the context node.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathNewBoolean()

xmlXPathObject * xmlXPathNewBoolean | ( | int | val | ) |

Create a new xmlXPathObject of type boolean and of value val.

Parameters

  val | the boolean value

Returns
  the newly created object.

## ◆ xmlXPathNewCString()

xmlXPathObject * xmlXPathNewCString | ( | const char * | val | ) |

Create a new xmlXPathObject of type string and of value val.

Parameters

  val | the char * value

Returns
  the newly created object.

## ◆ xmlXPathNewFloat()

xmlXPathObject * xmlXPathNewFloat | ( | double | val | ) |

Create a new xmlXPathObject of type double and of value val.

Parameters

  val | the double value

Returns
  the newly created object.

## ◆ xmlXPathNewNodeSet()

xmlXPathObject * xmlXPathNewNodeSet | ( | xmlNode * | val | ) |

Create a new xmlXPathObject of type NodeSet and initialize it with the single Node val.

Parameters

  val | the NodePtr value

Returns
  the newly created object.

## ◆ xmlXPathNewNodeSetList()

xmlXPathObject * xmlXPathNewNodeSetList | ( | xmlNodeSet * | val | ) |

Create a new xmlXPathObject of type NodeSet and initialize it with the Nodeset val.

Parameters

  val | an existing NodeSet

Returns
  the newly created object.

## ◆ xmlXPathNewParserContext()

xmlXPathParserContext * xmlXPathNewParserContext | ( | const xmlChar * | str,
|  | xmlXPathContext * | ctxt )

Utilities to extend XPath.

Utilities to extend XPath.

Parameters

  str | the XPath expression
  ctxt | the XPath context

Returns
  the xmlXPathParserContext just allocated.

## ◆ xmlXPathNewString()

xmlXPathObject * xmlXPathNewString | ( | const xmlChar * | val | ) |

Create a new xmlXPathObject of type string and of value val.

Parameters

  val | the xmlChar * value

Returns
  the newly created object.

## ◆ xmlXPathNewValueTree()

xmlXPathObject * xmlXPathNewValueTree | ( | xmlNode * | val | ) |

Create a new xmlXPathObject of type Value Tree (XSLT) and initialize it with the tree root val.

Parameters

  val | the NodePtr value

Returns
  the newly created object.

## ◆ xmlXPathNextAncestor()

xmlNode * xmlXPathNextAncestor | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "ancestor" direction the ancestor axis contains the ancestors of the context node; the ancestors of the context node consist of the parent of context node and the parent's parent and so on; the nodes are ordered in reverse document order; thus the parent is the first node on the axis, and the parent's parent is the second node on the axis.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextAncestorOrSelf()

xmlNode * xmlXPathNextAncestorOrSelf | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "ancestor-or-self" direction he ancestor-or-self axis contains the context node and ancestors of the context node in reverse document order; thus the context node is the first node on the axis, and the context node's parent the second; parent here is defined the same as with the parent axis.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextAttribute()

xmlNode * xmlXPathNextAttribute | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "attribute" direction TODO: support DTD inherited default attributes.

Parameters

  ctxt | the XPath Parser context
  cur | the current attribute in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextChild()

xmlNode * xmlXPathNextChild | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "child" direction The child axis contains the children of the context node in document order.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextDescendant()

xmlNode * xmlXPathNextDescendant | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "descendant" direction the descendant axis contains the descendants of the context node in document order; a descendant is a child or a child of a child and so on.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextDescendantOrSelf()

xmlNode * xmlXPathNextDescendantOrSelf | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "descendant-or-self" direction the descendant-or-self axis contains the context node and the descendants of the context node in document order; thus the context node is the first node on the axis, and the first child of the context node is the second node on the axis.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextFollowing()

xmlNode * xmlXPathNextFollowing | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "following" direction The following axis contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes and namespace nodes; the nodes are ordered in document order.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextFollowingSibling()

xmlNode * xmlXPathNextFollowingSibling | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "following-sibling" direction The following-sibling axis contains the following siblings of the context node in document order.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextNamespace()

xmlNode * xmlXPathNextNamespace | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "namespace" direction the namespace axis contains the namespace nodes of the context node; the order of nodes on this axis is implementation-defined; the axis will be empty unless the context node is an element.

We keep the XML namespace node at the end of the list.

Parameters

  ctxt | the XPath Parser context
  cur | the current attribute in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextParent()

xmlNode * xmlXPathNextParent | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "parent" direction The parent axis contains the parent of the context node, if there is one.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextPreceding()

xmlNode * xmlXPathNextPreceding | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "preceding" direction the preceding axis contains all nodes in the same document as the context node that are before the context node in document order, excluding any ancestors and excluding attribute nodes and namespace nodes; the nodes are ordered in reverse document order.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextPrecedingSibling()

xmlNode * xmlXPathNextPrecedingSibling | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "preceding-sibling" direction The preceding-sibling axis contains the preceding siblings of the context node in reverse document order; the first preceding sibling is first on the axis; the sibling preceding that node is the second on the axis and so on.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNextSelf()

xmlNode * xmlXPathNextSelf | ( | xmlXPathParserContext * | ctxt,
|  | xmlNode * | cur )

Traversal function for the "self" direction The self axis contains just the context node itself.

Parameters

  ctxt | the XPath Parser context
  cur | the current node in the traversal

Returns
  the next element following that axis

## ◆ xmlXPathNodeLeading()

xmlNodeSet * xmlXPathNodeLeading | ( | xmlNodeSet * | nodes,
|  | xmlNode * | node )

Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set) nodes is sorted by document order, then exslSetsNodeLeadingSorted is called.

Parameters

  nodes | a node-set
  node | a node

Returns
  the nodes in nodes that precede node in document order, nodes if node is NULL or an empty node-set if nodes doesn't contain node

## ◆ xmlXPathNodeLeadingSorted()

xmlNodeSet * xmlXPathNodeLeadingSorted | ( | xmlNodeSet * | nodes,
|  | xmlNode * | node )

Implements the EXSLT - Sets leading() function: node-set set:leading (node-set, node-set).

Parameters

  nodes | a node-set, sorted by document order
  node | a node

Returns
  the nodes in nodes that precede node in document order, nodes if node is NULL or an empty node-set if nodes doesn't contain node

## ◆ xmlXPathNodeSetAdd()

int xmlXPathNodeSetAdd | ( | xmlNodeSet * | cur,
|  | xmlNode * | val )

add a new xmlNode to an existing NodeSet

Parameters

  cur | the initial node set
  val | a new xmlNode

Returns
  0 in case of success, and -1 in case of error

## ◆ xmlXPathNodeSetAddNs()

int xmlXPathNodeSetAddNs | ( | xmlNodeSet * | cur,
|  | xmlNode * | node,
|  | xmlNs * | ns )

add a new namespace node to an existing NodeSet

Parameters

  cur | the initial node set
  node | the hosting node
  ns | a the namespace node

Returns
  0 in case of success and -1 in case of error

## ◆ xmlXPathNodeSetAddUnique()

int xmlXPathNodeSetAddUnique | ( | xmlNodeSet * | cur,
|  | xmlNode * | val )

add a new xmlNode to an existing NodeSet, optimized version when we are sure the node is not already in the set.

Parameters

  cur | the initial node set
  val | a new xmlNode

Returns
  0 in case of success and -1 in case of failure

## ◆ xmlXPathNodeSetContains()

int xmlXPathNodeSetContains | ( | xmlNodeSet * | cur,
|  | xmlNode * | val )

NodeSet handling.

NodeSet handling.

Parameters

  cur | the node-set
  val | the node

Returns
  true (1) if cur contains val, false (0) otherwise

## ◆ xmlXPathNodeSetDel()

void xmlXPathNodeSetDel | ( | xmlNodeSet * | cur,
|  | xmlNode * | val )

Removes an xmlNode from an existing NodeSet.

Parameters

  cur | the initial node set
  val | an xmlNode

## ◆ xmlXPathNodeSetFreeNs()

void xmlXPathNodeSetFreeNs | ( | xmlNs * | ns | ) |

Really internal functions.

Really internal functions.

In a node set the namespace nodes are duplicated and the next pointer is set to the parent node in the XPath semantic. Check if such a node needs to be freed

Parameters

  ns | the XPath namespace node found in a nodeset.

## ◆ xmlXPathNodeSetMerge()

xmlNodeSet * xmlXPathNodeSetMerge | ( | xmlNodeSet * | val1,
|  | xmlNodeSet * | val2 )

Merges two nodesets, all nodes from val2 are added to val1 if val1 is NULL, a new set is created and copied from val2.

Frees val1 in case of error.

Parameters

  val1 | the first NodeSet or NULL
  val2 | the second NodeSet

Returns
  val1 once extended or NULL in case of error.

## ◆ xmlXPathNodeSetRemove()

void xmlXPathNodeSetRemove | ( | xmlNodeSet * | cur,
|  | int | val )

Removes an entry from an existing NodeSet list.

Parameters

  cur | the initial node set
  val | the index to remove

## ◆ xmlXPathNodeSetSort()

void xmlXPathNodeSetSort | ( | xmlNodeSet * | set | ) |

Sort the node set in document order.

Parameters

  set | the node set

## ◆ xmlXPathNodeTrailing()

xmlNodeSet * xmlXPathNodeTrailing | ( | xmlNodeSet * | nodes,
|  | xmlNode * | node )

Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set) nodes is sorted by document order, then xmlXPathNodeTrailingSorted is called.

Parameters

  nodes | a node-set
  node | a node

Returns
  the nodes in nodes that follow node in document order, nodes if node is NULL or an empty node-set if nodes doesn't contain node

## ◆ xmlXPathNodeTrailingSorted()

xmlNodeSet * xmlXPathNodeTrailingSorted | ( | xmlNodeSet * | nodes,
|  | xmlNode * | node )

Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set).

Parameters

  nodes | a node-set, sorted by document order
  node | a node

Returns
  the nodes in nodes that follow node in document order, nodes if node is NULL or an empty node-set if nodes doesn't contain node

## ◆ xmlXPathNormalizeFunction()

void xmlXPathNormalizeFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the normalize-space() XPath function string normalize-space(string?) The normalize-space function returns the argument string with white space normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space.

Whitespace characters are the same allowed by the S production in XML. If the argument is omitted, it defaults to the context node converted to a string, in other words the value of the context node.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathNotEqualValues()

int xmlXPathNotEqualValues | ( | xmlXPathParserContext * | ctxt | ) |

Implement the equal operation on XPath objects content: arg1 == arg2.

Parameters

  ctxt | the XPath Parser context

Returns
  0 or 1 depending on the results of the test.

## ◆ xmlXPathNotFunction()

void xmlXPathNotFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the not() XPath function boolean not(boolean) The not function returns true if its argument is false, and false otherwise.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathNsLookup()

const xmlChar * xmlXPathNsLookup | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | prefix )

Search in the namespace declaration array of the context for the given namespace name associated to the given prefix.

Parameters

  ctxt | the XPath context
  prefix | the namespace prefix value

Returns
  the value or NULL if not found

## ◆ xmlXPathNumberFunction()

void xmlXPathNumberFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the number() XPath function number number(object?).

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathParseName()

xmlChar * xmlXPathParseName | ( | xmlXPathParserContext * | ctxt | ) |

parse an XML name

Parameters

  ctxt | the XPath Parser context

Returns
  the name or NULL

## ◆ xmlXPathParseNCName()

xmlChar * xmlXPathParseNCName | ( | xmlXPathParserContext * | ctxt | ) |

Parse an XML non-colonized name.

Parameters

  ctxt | the XPath Parser context

Returns
  the nc name or NULL

## ◆ xmlXPathPopBoolean()

int xmlXPathPopBoolean | ( | xmlXPathParserContext * | ctxt | ) |

Pops a boolean from the stack, handling conversion if needed.

Check error with xmlXPathCheckError.

Parameters

  ctxt | an XPath parser context

Returns
  the boolean

## ◆ xmlXPathPopExternal()

void * xmlXPathPopExternal | ( | xmlXPathParserContext * | ctxt | ) |

Pops an external object from the stack, handling conversion if needed.

Check error with xmlXPathCheckError.

Parameters

  ctxt | an XPath parser context

Returns
  the object

## ◆ xmlXPathPopNodeSet()

xmlNodeSet * xmlXPathPopNodeSet | ( | xmlXPathParserContext * | ctxt | ) |

Pops a node-set from the stack, handling conversion if needed.

Check error with xmlXPathCheckError.

Parameters

  ctxt | an XPath parser context

Returns
  the node-set

## ◆ xmlXPathPopNumber()

double xmlXPathPopNumber | ( | xmlXPathParserContext * | ctxt | ) |

Pops a number from the stack, handling conversion if needed.

Check error with xmlXPathCheckError.

Parameters

  ctxt | an XPath parser context

Returns
  the number

## ◆ xmlXPathPopString()

xmlChar * xmlXPathPopString | ( | xmlXPathParserContext * | ctxt | ) |

Pops a string from the stack, handling conversion if needed.

Check error with xmlXPathCheckError.

Parameters

  ctxt | an XPath parser context

Returns
  the string

## ◆ xmlXPathPositionFunction()

void xmlXPathPositionFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the position() XPath function number position() The position function returns the position of the context node in the context node list.

The first position is 1, and so the last position will be equal to last().

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathRegisterAllFunctions()

void xmlXPathRegisterAllFunctions | ( | xmlXPathContext * | ctxt | ) |

Registers all default XPath functions in this context.

Deprecated
  No-op since 2.14.0.

Parameters

  ctxt | the XPath context

## ◆ xmlXPathRegisteredFuncsCleanup()

void xmlXPathRegisteredFuncsCleanup | ( | xmlXPathContext * | ctxt | ) |

Cleanup the XPath context data associated to registered functions.

Parameters

  ctxt | the XPath context

## ◆ xmlXPathRegisteredNsCleanup()

void xmlXPathRegisteredNsCleanup | ( | xmlXPathContext * | ctxt | ) |

Cleanup the XPath context data associated to registered variables.

Parameters

  ctxt | the XPath context

## ◆ xmlXPathRegisteredVariablesCleanup()

void xmlXPathRegisteredVariablesCleanup | ( | xmlXPathContext * | ctxt | ) |

Cleanup the XPath context data associated to registered variables.

Parameters

  ctxt | the XPath context

## ◆ xmlXPathRegisterFunc()

int xmlXPathRegisterFunc | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | name,
|  | xmlXPathFunction | f )

Register a new function.

If f is NULL it unregisters the function

Parameters

  ctxt | the XPath context
  name | the function name
  f | the function implementation or NULL

Returns
  0 in case of success, -1 in case of error

## ◆ xmlXPathRegisterFuncLookup()

void xmlXPathRegisterFuncLookup | ( | xmlXPathContext * | ctxt,
|  | xmlXPathFuncLookupFunc | f,
|  | void * | funcCtxt )

Registers an external mechanism to do function lookup.

Parameters

  ctxt | the XPath context
  f | the lookup function
  funcCtxt | the lookup data

## ◆ xmlXPathRegisterFuncNS()

int xmlXPathRegisterFuncNS | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | name,
|  | const xmlChar * | ns_uri,
|  | xmlXPathFunction | f )

Register a new function.

If f is NULL it unregisters the function

Parameters

  ctxt | the XPath context
  name | the function name
  ns_uri | the function namespace URI
  f | the function implementation or NULL

Returns
  0 in case of success, -1 in case of error

## ◆ xmlXPathRegisterNs()

int xmlXPathRegisterNs | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | prefix,
|  | const xmlChar * | ns_uri )

Extending a context.

Extending a context.

If ns_uri is NULL it unregisters the namespace

Parameters

  ctxt | the XPath context
  prefix | the namespace prefix cannot be NULL or empty string
  ns_uri | the namespace name

Returns
  0 in case of success, -1 in case of error

## ◆ xmlXPathRegisterVariable()

int xmlXPathRegisterVariable | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | name,
|  | xmlXPathObject * | value )

Register a new variable value.

If value is NULL it unregisters the variable

Parameters

  ctxt | the XPath context
  name | the variable name
  value | the variable value or NULL

Returns
  0 in case of success, -1 in case of error

## ◆ xmlXPathRegisterVariableLookup()

void xmlXPathRegisterVariableLookup | ( | xmlXPathContext * | ctxt,
|  | xmlXPathVariableLookupFunc | f,
|  | void * | data )

register an external mechanism to do variable lookup

Parameters

  ctxt | the XPath context
  f | the lookup function
  data | the lookup data

## ◆ xmlXPathRegisterVariableNS()

int xmlXPathRegisterVariableNS | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | name,
|  | const xmlChar * | ns_uri,
|  | xmlXPathObject * | value )

Register a new variable value.

If value is NULL it unregisters the variable

Parameters

  ctxt | the XPath context
  name | the variable name
  ns_uri | the variable namespace URI
  value | the variable value or NULL

Returns
  0 in case of success, -1 in case of error

## ◆ xmlXPathRoot()

void xmlXPathRoot | ( | xmlXPathParserContext * | ctxt | ) |

Initialize the context to the root of the document.

Parameters

  ctxt | the XPath Parser context

## ◆ xmlXPathRoundFunction()

void xmlXPathRoundFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the round() XPath function number round(number) The round function returns the number that is closest to the argument and that is an integer.

If there are two such numbers, then the one that is closest to positive infinity is returned.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathStartsWithFunction()

void xmlXPathStartsWithFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the starts-with() XPath function boolean starts-with(string, string) The starts-with function returns true if the first argument string starts with the second argument string, and otherwise returns false.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathStringEvalNumber()

double xmlXPathStringEvalNumber | ( | const xmlChar * | str | ) |

[30a] Float ::= Number ('e' Digits?)?

[30] Number ::= Digits ('.' Digits?)? | '.' Digits [31] Digits ::= [0-9]+

Compile a Number in the string In complement of the Number expression, this function also handles negative values : '-' Number.

Parameters

  str | A string to scan

Returns
  the double value.

## ◆ xmlXPathStringFunction()

void xmlXPathStringFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the string() XPath function string string(object?) The string function converts an object to a string as follows:

- A node-set is converted to a string by returning the value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.
- A number is converted to a string as follows
  - NaN is converted to the string NaN
  - positive zero is converted to the string 0
  - negative zero is converted to the string 0
  - positive infinity is converted to the string Infinity
  - negative infinity is converted to the string -Infinity
  - if the number is an integer, the number is represented in decimal form as a Number with no decimal point and no leading zeros, preceded by a minus sign (-) if the number is negative
  - otherwise, the number is represented in decimal form as a Number including a decimal point with at least one digit before the decimal point and at least one digit after the decimal point, preceded by a minus sign (-) if the number is negative; there must be no leading zeros before the decimal point apart possibly from the one required digit immediately before the decimal point; beyond the one required digit after the decimal point there must be as many, but only as many, more digits as are needed to uniquely distinguish the number from all other IEEE 754 numeric values.
- The boolean false value is converted to the string false. The boolean true value is converted to the string true.

If the argument is omitted, it defaults to a node-set with the context node as its only member.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathStringLengthFunction()

void xmlXPathStringLengthFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the string-length() XPath function number string-length(string?) The string-length returns the number of characters in the string (see [3.6 Strings]).

If the argument is omitted, it defaults to the context node converted to a string, in other words the value of the context node.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathSubstringAfterFunction()

void xmlXPathSubstringAfterFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the substring-after() XPath function string substring-after(string, string) The substring-after function returns the substring of the first argument string that follows the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string.

For example, substring-after("1999/04/01","/") returns 04/01, and substring-after("1999/04/01","19") returns 99/04/01.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathSubstringBeforeFunction()

void xmlXPathSubstringBeforeFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the substring-before() XPath function string substring-before(string, string) The substring-before function returns the substring of the first argument string that precedes the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string.

For example, substring-before("1999/04/01","/") returns 1999.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathSubstringFunction()

void xmlXPathSubstringFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the substring() XPath function string substring(string, number, number?) The substring function returns the substring of the first argument starting at the position specified in the second argument with length specified in the third argument.

For example, substring("12345",2,3) returns "234". If the third argument is not specified, it returns the substring starting at the position specified in the second argument and continuing to the end of the string. For example, substring("12345",2) returns "2345". More precisely, each character in the string (see [3.6 Strings]) is considered to have a numeric position: the position of the first character is 1, the position of the second character is 2 and so on. The returned substring contains those characters for which the position of the character is greater than or equal to the second argument and, if the third argument is specified, less than the sum of the second and third arguments; the comparisons and addition used for the above follow the standard IEEE 754 rules. Thus:

- substring("12345", 1.5, 2.6) returns "234"
- substring("12345", 0, 3) returns "12"
- substring("12345", 0 div 0, 3) returns ""
- substring("12345", 1, 0 div 0) returns ""
- substring("12345", -42, 1 div 0) returns "12345"
- substring("12345", -1 div 0, 1 div 0) returns ""

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathSubValues()

void xmlXPathSubValues | ( | xmlXPathParserContext * | ctxt | ) |

Implement the subtraction operation on XPath objects: The numeric operators convert their operands to numbers as if by calling the number function.

Parameters

  ctxt | the XPath Parser context

## ◆ xmlXPathSumFunction()

void xmlXPathSumFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the sum() XPath function number sum(node-set) The sum function returns the sum of the values of the nodes in the argument node-set.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathTrailing()

xmlNodeSet * xmlXPathTrailing | ( | xmlNodeSet * | nodes1,
|  | xmlNodeSet * | nodes2 )

Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set) nodes1 and nodes2 are sorted by document order, then xmlXPathTrailingSorted is called.

Parameters

  nodes1 | a node-set
  nodes2 | a node-set

Returns
  the nodes in nodes1 that follow the first node in nodes2 in document order, nodes1 if nodes2 is NULL or empty or an empty node-set if nodes1 doesn't contain nodes2

## ◆ xmlXPathTrailingSorted()

xmlNodeSet * xmlXPathTrailingSorted | ( | xmlNodeSet * | nodes1,
|  | xmlNodeSet * | nodes2 )

Implements the EXSLT - Sets trailing() function: node-set set:trailing (node-set, node-set).

Parameters

  nodes1 | a node-set, sorted by document order
  nodes2 | a node-set, sorted by document order

Returns
  the nodes in nodes1 that follow the first node in nodes2 in document order, nodes1 if nodes2 is NULL or empty or an empty node-set if nodes1 doesn't contain nodes2

## ◆ xmlXPathTranslateFunction()

void xmlXPathTranslateFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the translate() XPath function string translate(string, string, string) The translate function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string.

For example, translate("bar","abc","ABC") returns the string BAr. If there is a character in the second argument string with no character at a corresponding position in the third argument string (because the second argument string is longer than the third argument string), then occurrences of that character in the first argument string are removed. For example, translate("--aaa--","abc-","ABC") returns "AAA". If a character occurs more than once in second argument string, then the first occurrence determines the replacement character. If the third argument string is longer than the second argument string, then excess characters are ignored.

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathTrueFunction()

void xmlXPathTrueFunction | ( | xmlXPathParserContext * | ctxt,
|  | int | nargs )

Implement the true() XPath function boolean true().

Parameters

  ctxt | the XPath Parser context
  nargs | the number of arguments

## ◆ xmlXPathValueFlipSign()

void xmlXPathValueFlipSign | ( | xmlXPathParserContext * | ctxt | ) |

Implement the unary - operation on an XPath object The numeric operators convert their operands to numbers as if by calling the number function.

Parameters

  ctxt | the XPath Parser context

## ◆ xmlXPathValuePop()

xmlXPathObject * xmlXPathValuePop | ( | xmlXPathParserContext * | ctxt | ) |

Pops the top XPath object from the value stack.

Parameters

  ctxt | an XPath evaluation context

Returns
  the XPath object just removed

## ◆ xmlXPathValuePush()

int xmlXPathValuePush | ( | xmlXPathParserContext * | ctxt,
|  | xmlXPathObject * | value )

Pushes a new XPath object on top of the value stack.

If value is NULL, a memory error is recorded in the parser context.

The object is destroyed in case of error.

Parameters

  ctxt | an XPath evaluation context
  value | the XPath object

Returns
  the number of items on the value stack, or -1 in case of error.

## ◆ xmlXPathVariableLookup()

xmlXPathObject * xmlXPathVariableLookup | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | name )

Search in the Variable array of the context for the given variable value.

Parameters

  ctxt | the XPath context
  name | the variable name

Returns
  a copy of the value or NULL if not found

## ◆ xmlXPathVariableLookupNS()

xmlXPathObject * xmlXPathVariableLookupNS | ( | xmlXPathContext * | ctxt,
|  | const xmlChar * | name,
|  | const xmlChar * | ns_uri )

Search in the Variable array of the context for the given variable value.

Parameters

  ctxt | the XPath context
  name | the variable name
  ns_uri | the variable namespace URI

Returns
  the a copy of the value or NULL if not found

## ◆ xmlXPathWrapCString()

xmlXPathObject * xmlXPathWrapCString | ( | char * | val | ) |

Wraps a string into an XPath object.

Parameters

  val | the char * value

Returns
  the newly created object.

## ◆ xmlXPathWrapExternal()

xmlXPathObject * xmlXPathWrapExternal | ( | void * | val | ) |

Wraps the val data into an XPath object.

Parameters

  val | the user data

Returns
  the newly created object.

## ◆ xmlXPathWrapNodeSet()

xmlXPathObject * xmlXPathWrapNodeSet | ( | xmlNodeSet * | val | ) |

Wrap the Nodeset val in a new xmlXPathObject.

In case of error the node set is destroyed and NULL is returned.

Parameters

  val | the NodePtr value

Returns
  the newly created object.

## ◆ xmlXPathWrapString()

xmlXPathObject * xmlXPathWrapString | ( | xmlChar * | val | ) |

Wraps the val string into an XPath object.

Frees val in case of error.

Parameters

  val | the xmlChar * value

Returns
  the newly created object.