Blame doc/devhelp/libxml2-xpath.html

Packit 423ecb
Packit 423ecb
<html>
Packit 423ecb
  <head>
Packit 423ecb
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Packit 423ecb
    <title>xpath: XML Path Language implementation</title>
Packit 423ecb
    <meta name="generator" content="Libxml2 devhelp stylesheet"/>
Packit 423ecb
    <link rel="start" href="index.html" title="libxml2 Reference Manual"/>
Packit 423ecb
    <link rel="up" href="general.html" title="API"/>
Packit 423ecb
    <link rel="stylesheet" href="style.css" type="text/css"/>
Packit 423ecb
    <link rel="chapter" href="general.html" title="API"/>
Packit 423ecb
  </head>
Packit 423ecb
  <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit 423ecb
    
Packit 423ecb
      
Packit 423ecb
        
Packit 423ecb
          
Packit 423ecb
            Prev
Packit 423ecb
          
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb
          
Packit 423ecb
            Up
Packit 423ecb
          
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb
          
Packit 423ecb
            Home
Packit 423ecb
          
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb
          
Packit 423ecb
            Next
Packit 423ecb
          
Packit 423ecb
        
Packit 423ecb
        libxml2 Reference Manual
Packit 423ecb
      
Packit 423ecb
    
Packit 423ecb
    

Packit 423ecb
      xpath
Packit 423ecb
    
Packit 423ecb
    

xpath - XML Path Language implementation

Packit 423ecb
    

API for the XML Path Language implementation XML Path Language implementation XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer

Packit 423ecb
    

Author(s): Daniel Veillard

Packit 423ecb
    
Packit 423ecb
      

Synopsis

Packit 423ecb
      
#define xmlXPathNodeSetGetLength(ns);
Packit 423ecb
#define XML_XPATH_CHECKNS;
Packit 423ecb
#define XML_XPATH_NOVAR;
Packit 423ecb
#define xmlXPathNodeSetItem(ns, index);
Packit 423ecb
#define xmlXPathNodeSetIsEmpty(ns);
Packit 423ecb
typedef enum xmlXPathObjectType;
Packit 423ecb
typedef xmlXPathVariable * xmlXPathVariablePtr;
Packit 423ecb
typedef struct _xmlXPathContext xmlXPathContext;
Packit 423ecb
typedef enum xmlXPathError;
Packit 423ecb
typedef struct _xmlXPathFunct xmlXPathFunct;
Packit 423ecb
typedef xmlXPathType * xmlXPathTypePtr;
Packit 423ecb
typedef struct _xmlXPathType xmlXPathType;
Packit 423ecb
typedef xmlNodeSet * xmlNodeSetPtr;
Packit 423ecb
typedef xmlXPathFunct * xmlXPathFuncPtr;
Packit 423ecb
typedef xmlXPathCompExpr * xmlXPathCompExprPtr;
Packit 423ecb
typedef struct _xmlXPathObject xmlXPathObject;
Packit 423ecb
typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
Packit 423ecb
typedef xmlXPathContext * xmlXPathContextPtr;
Packit 423ecb
typedef xmlXPathParserContext * xmlXPathParserContextPtr;
Packit 423ecb
typedef struct _xmlNodeSet xmlNodeSet;
Packit 423ecb
typedef struct _xmlXPathVariable xmlXPathVariable;
Packit 423ecb
typedef xmlXPathObject * xmlXPathObjectPtr;
Packit 423ecb
typedef struct _xmlXPathAxis xmlXPathAxis;
Packit 423ecb
typedef xmlXPathAxis * xmlXPathAxisPtr;
Packit 423ecb
typedef struct _xmlXPathParserContext xmlXPathParserContext;
Packit 423ecb
int	xmlXPathCastNodeSetToBoolean	(xmlNodeSetPtr ns);
Packit 423ecb
typedef xmlXPathFunction xmlXPathFuncLookupFunc	(void * ctxt, 
const xmlChar * name,
const xmlChar * ns_uri);
Packit 423ecb
xmlXPathObjectPtr	xmlXPathNodeEval	(xmlNodePtr node, 
const xmlChar * str,
xmlXPathContextPtr ctx);
Packit 423ecb
xmlChar *	xmlXPathCastNodeToString	(xmlNodePtr node);
Packit 423ecb
int	xmlXPathIsNaN			(double val);
Packit 423ecb
int	xmlXPathContextSetCache		(xmlXPathContextPtr ctxt, 
int active,
int value,
int options);
Packit 423ecb
xmlXPathObjectPtr	xmlXPathConvertString	(xmlXPathObjectPtr val);
Packit 423ecb
int	xmlXPathCompiledEvalToBoolean	(xmlXPathCompExprPtr comp, 
xmlXPathContextPtr ctxt);
Packit 423ecb
int	xmlXPathIsInf			(double val);
Packit 423ecb
long	xmlXPathOrderDocElems		(xmlDocPtr doc);
Packit 423ecb
xmlNodeSetPtr	xmlXPathNodeSetCreate	(xmlNodePtr val);
Packit 423ecb
double	xmlXPathCastBooleanToNumber	(int val);
Packit 423ecb
double	xmlXPathCastNodeToNumber	(xmlNodePtr node);
Packit 423ecb
double	xmlXPathCastStringToNumber	(const xmlChar * val);
Packit 423ecb
typedef xmlXPathObjectPtr xmlXPathAxisFunc	(xmlXPathParserContextPtr ctxt, 
xmlXPathObjectPtr cur);
Packit 423ecb
double	xmlXPathCastToNumber		(xmlXPathObjectPtr val);
Packit 423ecb
int	xmlXPathCastStringToBoolean	(const xmlChar * val);
Packit 423ecb
xmlChar *	xmlXPathCastNumberToString	(double val);
Packit 423ecb
typedef xmlXPathObjectPtr xmlXPathVariableLookupFunc	(void * ctxt, 
const xmlChar * name,
const xmlChar * ns_uri);
Packit 423ecb
void	xmlXPathFreeObject		(xmlXPathObjectPtr obj);
Packit 423ecb
int	xmlXPathEvalPredicate		(xmlXPathContextPtr ctxt, 
xmlXPathObjectPtr res);
Packit 423ecb
void	xmlXPathFreeContext		(xmlXPathContextPtr ctxt);
Packit 423ecb
xmlXPathObjectPtr	xmlXPathObjectCopy	(xmlXPathObjectPtr val);
Packit 423ecb
void	xmlXPathFreeNodeSetList		(xmlXPathObjectPtr obj);
Packit 423ecb
xmlXPathObjectPtr	xmlXPathEval	(const xmlChar * str, 
xmlXPathContextPtr ctx);
Packit 423ecb
xmlChar *	xmlXPathCastNodeSetToString	(xmlNodeSetPtr ns);
Packit 423ecb
xmlXPathObjectPtr	xmlXPathCompiledEval	(xmlXPathCompExprPtr comp, 
xmlXPathContextPtr ctx);
Packit 423ecb
xmlXPathObjectPtr	xmlXPathEvalExpression	(const xmlChar * str, 
xmlXPathContextPtr ctxt);
Packit 423ecb
void	xmlXPathInit			(void);
Packit 423ecb
xmlXPathObjectPtr	xmlXPathConvertBoolean	(xmlXPathObjectPtr val);
Packit 423ecb
typedef int xmlXPathConvertFunc		(xmlXPathObjectPtr obj, 
int type);
Packit 423ecb
typedef void xmlXPathFunction		(xmlXPathParserContextPtr ctxt, 
int nargs);
Packit 423ecb
int	xmlXPathCmpNodes		(xmlNodePtr node1, 
xmlNodePtr node2);
Packit 423ecb
xmlChar *	xmlXPathCastToString	(xmlXPathObjectPtr val);
Packit 423ecb
xmlXPathCompExprPtr	xmlXPathCtxtCompile	(xmlXPathContextPtr ctxt, 
const xmlChar * str);
Packit 423ecb
typedef void xmlXPathEvalFunc		(xmlXPathParserContextPtr ctxt, 
int nargs);
Packit 423ecb
xmlChar *	xmlXPathCastBooleanToString	(int val);
Packit 423ecb
int	xmlXPathSetContextNode		(xmlNodePtr node, 
xmlXPathContextPtr ctx);
Packit 423ecb
int	xmlXPathCastNumberToBoolean	(double val);
Packit 423ecb
void	xmlXPathFreeNodeSet		(xmlNodeSetPtr obj);
Packit 423ecb
void	xmlXPathFreeCompExpr		(xmlXPathCompExprPtr comp);
Packit 423ecb
xmlXPathContextPtr	xmlXPathNewContext	(xmlDocPtr doc);
Packit 423ecb
xmlXPathObjectPtr	xmlXPathConvertNumber	(xmlXPathObjectPtr val);
Packit 423ecb
xmlXPathCompExprPtr	xmlXPathCompile	(const xmlChar * str);
Packit 423ecb
double	xmlXPathCastNodeSetToNumber	(xmlNodeSetPtr ns);
Packit 423ecb
int	xmlXPathCastToBoolean		(xmlXPathObjectPtr val);
Packit 423ecb
Packit 423ecb
    
Packit 423ecb
    
Packit 423ecb
      

Description

Packit 423ecb
    
Packit 423ecb
    
Packit 423ecb
      

Details

Packit 423ecb
      
Packit 423ecb
        

Macro XML_XPATH_CHECKNS

#define XML_XPATH_CHECKNS;
Packit 423ecb

check namespaces at compilation

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Macro XML_XPATH_NOVAR

#define XML_XPATH_NOVAR;
Packit 423ecb

forbid variables in expression

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Macro xmlXPathNodeSetGetLength

#define xmlXPathNodeSetGetLength(ns);
Packit 423ecb

Implement a functionality similar to the DOM NodeList.length. Returns the number of nodes in the node-set.

<tt>ns</tt>:a node-set
Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Macro xmlXPathNodeSetIsEmpty

#define xmlXPathNodeSetIsEmpty(ns);
Packit 423ecb

Checks whether @ns is empty or not. Returns %TRUE if @ns is an empty node-set.

<tt>ns</tt>:a node-set
Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Macro xmlXPathNodeSetItem

#define xmlXPathNodeSetItem(ns, index);
Packit 423ecb

Implements a functionality similar to the DOM NodeList.item(). Returns the xmlNodePtr at the given @index in @ns or NULL if @index is out of range (0 to length-1)

<tt>ns</tt>:a node-set
<tt>index</tt>:index of a node in the set
Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlNodeSet

struct _xmlNodeSet {
Packit 423ecb
    int	nodeNr	: number of nodes in the set
Packit 423ecb
    int	nodeMax	: size of the array as allocated
Packit 423ecb
    xmlNodePtr *	nodeTab	: array of nodes in no particular order @@ with_ns to check wether name
Packit 423ecb
} xmlNodeSet;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlNodeSetPtr

xmlNodeSet * xmlNodeSetPtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlXPathAxis

struct _xmlXPathAxis {
Packit 423ecb
    const xmlChar *	name	: the axis name
Packit 423ecb
    xmlXPathAxisFunc	func	: the search function
Packit 423ecb
} xmlXPathAxis;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlXPathAxisPtr

xmlXPathAxis * xmlXPathAxisPtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlXPathCompExpr

struct _xmlXPathCompExpr {
Packit 423ecb
The content of this structure is not made public by the API.
Packit 423ecb
} xmlXPathCompExpr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlXPathCompExprPtr

xmlXPathCompExpr * xmlXPathCompExprPtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlXPathContext

struct _xmlXPathContext {
Packit 423ecb
    xmlDocPtr	doc	: The current document
Packit 423ecb
    xmlNodePtr	node	: The current node
Packit 423ecb
    int	nb_variables_unused	: unused (hash table)
Packit 423ecb
    int	max_variables_unused	: unused (hash table)
Packit 423ecb
    xmlHashTablePtr	varHash	: Hash table of defined variables
Packit 423ecb
    int	nb_types	: number of defined types
Packit 423ecb
    int	max_types	: max number of types
Packit 423ecb
    xmlXPathTypePtr	types	: Array of defined types
Packit 423ecb
    int	nb_funcs_unused	: unused (hash table)
Packit 423ecb
    int	max_funcs_unused	: unused (hash table)
Packit 423ecb
    xmlHashTablePtr	funcHash	: Hash table of defined funcs
Packit 423ecb
    int	nb_axis	: number of defined axis
Packit 423ecb
    int	max_axis	: max number of axis
Packit 423ecb
    xmlXPathAxisPtr	axis	: Array of defined axis the namespace nodes of the context node
Packit 423ecb
    xmlNsPtr *	namespaces	: Array of namespaces
Packit 423ecb
    int	nsNr	: number of namespace in scope
Packit 423ecb
    void *	user	: function to free extra variables
Packit 423ecb
    int	contextSize	: the context size
Packit 423ecb
    int	proximityPosition	: the proximity position extra stuff for XPointer
Packit 423ecb
    int	xptr	: is this an XPointer context?
Packit 423ecb
    xmlNodePtr	here	: for here()
Packit 423ecb
    xmlNodePtr	origin	: for origin() the set of namespace declarations in scope for the expre
Packit 423ecb
    xmlHashTablePtr	nsHash	: The namespaces hash table
Packit 423ecb
    xmlXPathVariableLookupFunc	varLookupFunc	: variable lookup func
Packit 423ecb
    void *	varLookupData	: variable lookup data Possibility to link in an extra item
Packit 423ecb
    void *	extra	: needed for XSLT The function name and URI when calling a function
Packit 423ecb
    const xmlChar *	function
Packit 423ecb
    const xmlChar *	functionURI	: function lookup function and data
Packit 423ecb
    xmlXPathFuncLookupFunc	funcLookupFunc	: function lookup func
Packit 423ecb
    void *	funcLookupData	: function lookup data temporary namespace lists kept for walking the n
Packit 423ecb
    xmlNsPtr *	tmpNsList	: Array of namespaces
Packit 423ecb
    int	tmpNsNr	: number of namespaces in scope error reporting mechanism
Packit 423ecb
    void *	userData	: user specific data block
Packit 423ecb
    xmlStructuredErrorFunc	error	: the callback in case of errors
Packit 423ecb
    xmlError	lastError	: the last error
Packit 423ecb
    xmlNodePtr	debugNode	: the source node XSLT dictionary
Packit 423ecb
    xmlDictPtr	dict	: dictionary if any
Packit 423ecb
    int	flags	: flags to control compilation Cache for reusal of XPath objects
Packit 423ecb
    void *	cache
Packit 423ecb
} xmlXPathContext;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlXPathContextPtr

xmlXPathContext * xmlXPathContextPtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Enum xmlXPathError

enum xmlXPathError {
Packit 423ecb
    XPATH_EXPRESSION_OK = 0
Packit 423ecb
    XPATH_NUMBER_ERROR = 1
Packit 423ecb
    XPATH_UNFINISHED_LITERAL_ERROR = 2
Packit 423ecb
    XPATH_START_LITERAL_ERROR = 3
Packit 423ecb
    XPATH_VARIABLE_REF_ERROR = 4
Packit 423ecb
    XPATH_UNDEF_VARIABLE_ERROR = 5
Packit 423ecb
    XPATH_INVALID_PREDICATE_ERROR = 6
Packit 423ecb
    XPATH_EXPR_ERROR = 7
Packit 423ecb
    XPATH_UNCLOSED_ERROR = 8
Packit 423ecb
    XPATH_UNKNOWN_FUNC_ERROR = 9
Packit 423ecb
    XPATH_INVALID_OPERAND = 10
Packit 423ecb
    XPATH_INVALID_TYPE = 11
Packit 423ecb
    XPATH_INVALID_ARITY = 12
Packit 423ecb
    XPATH_INVALID_CTXT_SIZE = 13
Packit 423ecb
    XPATH_INVALID_CTXT_POSITION = 14
Packit 423ecb
    XPATH_MEMORY_ERROR = 15
Packit 423ecb
    XPTR_SYNTAX_ERROR = 16
Packit 423ecb
    XPTR_RESOURCE_ERROR = 17
Packit 423ecb
    XPTR_SUB_RESOURCE_ERROR = 18
Packit 423ecb
    XPATH_UNDEF_PREFIX_ERROR = 19
Packit 423ecb
    XPATH_ENCODING_ERROR = 20
Packit 423ecb
    XPATH_INVALID_CHAR_ERROR = 21
Packit 423ecb
    XPATH_INVALID_CTXT = 22
Packit 423ecb
    XPATH_STACK_ERROR = 23
Packit 423ecb
    XPATH_FORBID_VARIABLE_ERROR = 24
Packit 423ecb
};
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlXPathFuncPtr

xmlXPathFunct * xmlXPathFuncPtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlXPathFunct

struct _xmlXPathFunct {
Packit 423ecb
    const xmlChar *	name	: the function name
Packit 423ecb
    xmlXPathEvalFunc	func	: the evaluation function
Packit 423ecb
} xmlXPathFunct;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlXPathObject

struct _xmlXPathObject {
Packit 423ecb
    xmlXPathObjectType	type
Packit 423ecb
    xmlNodeSetPtr	nodesetval
Packit 423ecb
    int	boolval
Packit 423ecb
    double	floatval
Packit 423ecb
    xmlChar *	stringval
Packit 423ecb
    void *	user
Packit 423ecb
    int	index
Packit 423ecb
    void *	user2
Packit 423ecb
    int	index2
Packit 423ecb
} xmlXPathObject;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlXPathObjectPtr

xmlXPathObject * xmlXPathObjectPtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Enum xmlXPathObjectType

enum xmlXPathObjectType {
Packit 423ecb
    XPATH_UNDEFINED = 0
Packit 423ecb
    XPATH_NODESET = 1
Packit 423ecb
    XPATH_BOOLEAN = 2
Packit 423ecb
    XPATH_NUMBER = 3
Packit 423ecb
    XPATH_STRING = 4
Packit 423ecb
    XPATH_POINT = 5
Packit 423ecb
    XPATH_RANGE = 6
Packit 423ecb
    XPATH_LOCATIONSET = 7
Packit 423ecb
    XPATH_USERS = 8
Packit 423ecb
    XPATH_XSLT_TREE = 9 /*  An XSLT value tree, non modifiable */
Packit 423ecb
};
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlXPathParserContext

struct _xmlXPathParserContext {
Packit 423ecb
    const xmlChar *	cur	: the current char being parsed
Packit 423ecb
    const xmlChar *	base	: the full expression
Packit 423ecb
    int	error	: error code
Packit 423ecb
    xmlXPathContextPtr	context	: the evaluation context
Packit 423ecb
    xmlXPathObjectPtr	value	: the current value
Packit 423ecb
    int	valueNr	: number of values stacked
Packit 423ecb
    int	valueMax	: max number of values stacked
Packit 423ecb
    xmlXPathObjectPtr *	valueTab	: stack of values
Packit 423ecb
    xmlXPathCompExprPtr	comp	: the precompiled expression
Packit 423ecb
    int	xptr	: it this an XPointer expression
Packit 423ecb
    xmlNodePtr	ancestor	: used for walking preceding axis
Packit 423ecb
    int	valueFrame	: used to limit Pop on the stack
Packit 423ecb
} xmlXPathParserContext;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlXPathParserContextPtr

xmlXPathParserContext * xmlXPathParserContextPtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlXPathType

struct _xmlXPathType {
Packit 423ecb
    const xmlChar *	name	: the type name
Packit 423ecb
    xmlXPathConvertFunc	func	: the conversion function
Packit 423ecb
} xmlXPathType;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlXPathTypePtr

xmlXPathType * xmlXPathTypePtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Structure xmlXPathVariable

struct _xmlXPathVariable {
Packit 423ecb
    const xmlChar *	name	: the variable name
Packit 423ecb
    xmlXPathObjectPtr	value	: the value
Packit 423ecb
} xmlXPathVariable;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Typedef xmlXPathVariablePtr

xmlXPathVariable * xmlXPathVariablePtr;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

An axis traversal function. To traverse an axis, the engine calls the first time with cur == NULL and repeat until the function returns NULL indicating the end of the axis traversal.

Packit 423ecb
<tt>ctxt</tt>:the XPath interpreter context
<tt>cur</tt>:the previous node being explored on that axis
<tt>Returns</tt>:the next node in that axis or NULL if at the end of the axis.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

A conversion function is associated to a type and used to cast the new type to primitive values.

Packit 423ecb
<tt>obj</tt>:an XPath object
<tt>type</tt>:the number of the target type
<tt>Returns</tt>:-1 in case of error, 0 otherwise
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

An XPath evaluation function, the parameters are on the XPath context stack.

Packit 423ecb
<tt>ctxt</tt>:an XPath parser context
<tt>nargs</tt>:the number of arguments passed to the function
Packit 423ecb
        
Packit 423ecb
        

Function type xmlXPathFuncLookupFunc

xmlXPathFunction	xmlXPathFuncLookupFunc	(void * ctxt, 
const xmlChar * name,
const xmlChar * ns_uri)
Packit 423ecb

Prototype for callbacks used to plug function lookup in the XPath engine.

Packit 423ecb
<tt>ctxt</tt>:an XPath context
<tt>name</tt>:name of the function
<tt>ns_uri</tt>:the namespace name hosting this function
<tt>Returns</tt>:the XPath function or NULL if not found.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

An XPath function. The arguments (if any) are popped out from the context stack and the result is pushed on the stack.

Packit 423ecb
<tt>ctxt</tt>:the XPath interprestation context
<tt>nargs</tt>:the number of arguments
Packit 423ecb
        
Packit 423ecb
        

Function type xmlXPathVariableLookupFunc

xmlXPathObjectPtr	xmlXPathVariableLookupFunc	(void * ctxt, 
const xmlChar * name,
const xmlChar * ns_uri)
Packit 423ecb

Prototype for callbacks used to plug variable lookup in the XPath engine.

Packit 423ecb
<tt>ctxt</tt>:an XPath context
<tt>name</tt>:name of the variable
<tt>ns_uri</tt>:the namespace name hosting this variable
<tt>Returns</tt>:the XPath object value or NULL if not found.
Packit 423ecb
        
Packit 423ecb
        

Variable xmlXPathNAN

double xmlXPathNAN;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Variable xmlXPathNINF

double xmlXPathNINF;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        

Variable xmlXPathPINF

double xmlXPathPINF;
Packit 423ecb

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts a boolean to its number value

Packit 423ecb
<tt>val</tt>:a boolean
<tt>Returns</tt>:the number value
Packit 423ecb
        
Packit 423ecb
        

xmlXPathCastBooleanToString ()

xmlChar *	xmlXPathCastBooleanToString	(int val)
Packit 423ecb

Converts a boolean to its string value.

Packit 423ecb
<tt>val</tt>:a boolean
<tt>Returns</tt>:a newly allocated string.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts a node-set to its boolean value

Packit 423ecb
<tt>ns</tt>:a node-set
<tt>Returns</tt>:the boolean value
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts a node-set to its number value

Packit 423ecb
<tt>ns</tt>:a node-set
<tt>Returns</tt>:the number value
Packit 423ecb
        
Packit 423ecb
        

xmlXPathCastNodeSetToString ()

xmlChar *	xmlXPathCastNodeSetToString	(xmlNodeSetPtr ns)
Packit 423ecb

Converts a node-set to its string value.

Packit 423ecb
<tt>ns</tt>:a node-set
<tt>Returns</tt>:a newly allocated string.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts a node to its number value

Packit 423ecb
<tt>node</tt>:a node
<tt>Returns</tt>:the number value
Packit 423ecb
        
Packit 423ecb
        

xmlXPathCastNodeToString ()

xmlChar *	xmlXPathCastNodeToString	(xmlNodePtr node)
Packit 423ecb

Converts a node to its string value.

Packit 423ecb
<tt>node</tt>:a node
<tt>Returns</tt>:a newly allocated string.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts a number to its boolean value

Packit 423ecb
<tt>val</tt>:a number
<tt>Returns</tt>:the boolean value
Packit 423ecb
        
Packit 423ecb
        

xmlXPathCastNumberToString ()

xmlChar *	xmlXPathCastNumberToString	(double val)
Packit 423ecb

Converts a number to its string value.

Packit 423ecb
<tt>val</tt>:a number
<tt>Returns</tt>:a newly allocated string.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts a string to its boolean value

Packit 423ecb
<tt>val</tt>:a string
<tt>Returns</tt>:the boolean value
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts a string to its number value

Packit 423ecb
<tt>val</tt>:a string
<tt>Returns</tt>:the number value
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts an XPath object to its boolean value

Packit 423ecb
<tt>val</tt>:an XPath object
<tt>Returns</tt>:the boolean value
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts an XPath object to its number value

Packit 423ecb
<tt>val</tt>:an XPath object
<tt>Returns</tt>:the number value
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts an existing object to its string() equivalent

Packit 423ecb
<tt>val</tt>:an XPath object
<tt>Returns</tt>:the allocated string value of the object, NULL in case of error. It's up to the caller to free the string memory with xmlFree().
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Compare two nodes w.r.t document order

Packit 423ecb
<tt>node1</tt>:the first node
<tt>node2</tt>:the second node
<tt>Returns</tt>:-2 in case of error 1 if first point < second point, 0 if it's the same node, -1 otherwise
Packit 423ecb
        
Packit 423ecb
        

xmlXPathCompile ()

xmlXPathCompExprPtr	xmlXPathCompile	(const xmlChar * str)
Packit 423ecb

Compile an XPath expression

Packit 423ecb
<tt>str</tt>:the XPath expression
<tt>Returns</tt>:the xmlXPathCompExprPtr resulting from the compilation or NULL. the caller has to free the object.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Evaluate the Precompiled XPath expression in the given context.

Packit 423ecb
<tt>comp</tt>:the compiled XPath expression
<tt>ctx</tt>:the XPath context
<tt>Returns</tt>:the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Applies the XPath boolean() function on the result of the given compiled expression.

Packit 423ecb
<tt>comp</tt>:the compiled XPath expression
<tt>ctxt</tt>:the XPath context
<tt>Returns</tt>:1 if the expression evaluated to true, 0 if to false and -1 in API and internal errors.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Creates/frees an object cache on the XPath context. If activates XPath objects (xmlXPathObject) will be cached internally to be reused. @options: 0: This will set the XPath object caching: @value: This will set the maximum number of XPath objects to be cached per slot There are 5 slots for: node-set, string, number, boolean, and misc objects. Use <0 for the default number (100). Other values for @options have currently no effect.

Packit 423ecb
<tt>ctxt</tt>:the XPath context
<tt>active</tt>:enables/disables (creates/frees) the cache
<tt>value</tt>:a value with semantics dependant on @options
<tt>options</tt>:options (currently only the value 0 is used)
<tt>Returns</tt>:0 if the setting succeeded, and -1 on API or internal errors.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts an existing object to its boolean() equivalent

Packit 423ecb
<tt>val</tt>:an XPath object
<tt>Returns</tt>:the new object, the old one is freed (or the operation is done directly on @val)
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts an existing object to its number() equivalent

Packit 423ecb
<tt>val</tt>:an XPath object
<tt>Returns</tt>:the new object, the old one is freed (or the operation is done directly on @val)
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Converts an existing object to its string() equivalent

Packit 423ecb
<tt>val</tt>:an XPath object
<tt>Returns</tt>:the new object, the old one is freed (or the operation is done directly on @val)
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Compile an XPath expression

Packit 423ecb
<tt>ctxt</tt>:an XPath context
<tt>str</tt>:the XPath expression
<tt>Returns</tt>:the xmlXPathCompExprPtr resulting from the compilation or NULL. the caller has to free the object.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Evaluate the XPath Location Path in the given context.

Packit 423ecb
<tt>str</tt>:the XPath expression
<tt>ctx</tt>:the XPath context
<tt>Returns</tt>:the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.
Packit 423ecb
        
Packit 423ecb
        

xmlXPathEvalExpression ()

xmlXPathObjectPtr	xmlXPathEvalExpression	(const xmlChar * str, 
xmlXPathContextPtr ctxt)
Packit 423ecb

Alias for xmlXPathEval().

Packit 423ecb
<tt>str</tt>:the XPath expression
<tt>ctxt</tt>:the XPath context
<tt>Returns</tt>:the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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.

Packit 423ecb
<tt>ctxt</tt>:the XPath context
<tt>res</tt>:the Predicate Expression evaluation result
<tt>Returns</tt>:1 if predicate is true, 0 otherwise
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Free up the memory allocated by @comp

Packit 423ecb
<tt>comp</tt>:an XPATH comp
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Free up an xmlXPathContext

Packit 423ecb
<tt>ctxt</tt>:the context to free
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Free the NodeSet compound (not the actual nodes !).

Packit 423ecb
<tt>obj</tt>:the xmlNodeSetPtr to free
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Free up the xmlXPathObjectPtr @obj but don't deallocate the objects in the list contrary to xmlXPathFreeObject().

Packit 423ecb
<tt>obj</tt>:an existing NodeSetList object
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Free up an xmlXPathObjectPtr object.

Packit 423ecb
<tt>obj</tt>:the object to free
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Initialize the XPath environment

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Provides a portable isinf() function to detect whether a double is a +Infinite or -Infinite. Based on trio code http://sourceforge.net/projects/ctrio/

Packit 423ecb
<tt>val</tt>:a double value
<tt>Returns</tt>:1 vi the value is +Infinite, -1 if -Infinite, 0 otherwise
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Provides a portable isnan() function to detect whether a double is a NotaNumber. Based on trio code http://sourceforge.net/projects/ctrio/

Packit 423ecb
<tt>val</tt>:a double value
<tt>Returns</tt>:1 if the value is a NaN, 0 otherwise
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Create a new xmlXPathContext

Packit 423ecb
<tt>doc</tt>:the XML document
<tt>Returns</tt>:the xmlXPathContext just allocated. The caller will need to free it.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Evaluate the XPath Location Path in the given context. The node 'node' is set as the context node. The context node is not restored.

Packit 423ecb
<tt>node</tt>:the node to to use as the context node
<tt>str</tt>:the XPath expression
<tt>ctx</tt>:the XPath context
<tt>Returns</tt>:the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Create a new xmlNodeSetPtr of type double and of value @val

Packit 423ecb
<tt>val</tt>:an initial xmlNodePtr, or NULL
<tt>Returns</tt>:the newly created object.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

allocate a new copy of a given object

Packit 423ecb
<tt>val</tt>:the original object
<tt>Returns</tt>:the newly created object.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Call this routine to speed up XPath computation on static documents. This stamps all the element nodes with the document order Like for line information, the order is kept in the element->content field, the value stored is actually - the node number (starting at -1) to be able to differentiate from line numbers.

Packit 423ecb
<tt>doc</tt>:an input document
<tt>Returns</tt>:the number of elements found in the document or -1 in case of error.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Sets 'node' as the context node. The node must be in the same document as that associated with the context.

Packit 423ecb
<tt>node</tt>:the node to to use as the context node
<tt>ctx</tt>:the XPath context
<tt>Returns</tt>:-1 in case of error or 0 if successful
Packit 423ecb
        
Packit 423ecb
      
Packit 423ecb
    
Packit 423ecb
  </body>
Packit 423ecb
</html>