ADC Home > Reference Library > Reference > Darwin > Miscellaneous User Space API Reference

 


xpath.h

Includes:

Introduction



Typedefs


xmlXPathAxisFunc


typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (
    xmlXPathParserContextPtr ctxt, 
    xmlXPathObjectPtr cur);  
Discussion

xmlXPathAxisFunc: @ctxt: the XPath interpreter context @cur: the previous node being explored on that axis

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.

Returns the next node in that axis or NULL if at the end of the axis.


xmlXPathConvertFunc


typedef int (*xmlXPathConvertFunc) (
    xmlXPathObjectPtr obj,
    int type);  
Discussion

xmlXPathConvertFunc: @obj: an XPath object @type: the number of the target type

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

Returns -1 in case of error, 0 otherwise


xmlXPathError


typedef enum { 
    XPATH_EXPRESSION_OK = 0, 
    XPATH_NUMBER_ERROR, 
    XPATH_UNFINISHED_LITERAL_ERROR, 
    XPATH_START_LITERAL_ERROR, 
    XPATH_VARIABLE_REF_ERROR, 
    XPATH_UNDEF_VARIABLE_ERROR, 
    XPATH_INVALID_PREDICATE_ERROR, 
    XPATH_EXPR_ERROR, 
    XPATH_UNCLOSED_ERROR, 
    XPATH_UNKNOWN_FUNC_ERROR, 
    XPATH_INVALID_OPERAND, 
    XPATH_INVALID_TYPE, 
    XPATH_INVALID_ARITY, 
    XPATH_INVALID_CTXT_SIZE, 
    XPATH_INVALID_CTXT_POSITION, 
    XPATH_MEMORY_ERROR, 
    XPTR_SYNTAX_ERROR, 
    XPTR_RESOURCE_ERROR, 
    XPTR_SUB_RESOURCE_ERROR, 
    XPATH_UNDEF_PREFIX_ERROR, 
    XPATH_ENCODING_ERROR, 
    XPATH_INVALID_CHAR_ERROR, 
    XPATH_INVALID_CTXT 
} xmlXPathError;  
Discussion

The set of XPath error codes.


xmlXPathEvalFunc


typedef void (*xmlXPathEvalFunc)(
    xmlXPathParserContextPtr ctxt, 
    int nargs);  
Discussion

xmlXPathEvalFunc: @ctxt: an XPath parser context @nargs: the number of arguments passed to the function

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


xmlXPathFuncLookupFunc


typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (
    void *ctxt, 
    const xmlChar *name, 
    const xmlChar *ns_uri);  
Discussion

xmlXPathFuncLookupFunc: @ctxt: an XPath context @name: name of the function @ns_uri: the namespace name hosting this function

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

Returns the XPath function or NULL if not found.


xmlXPathFunction


typedef void (*xmlXPathFunction) (
    xmlXPathParserContextPtr ctxt,
    int nargs);  
Discussion

xmlXPathFunction: @ctxt: the XPath interprestation context @nargs: the number of arguments

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


xmlXPathVariableLookupFunc


typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (
    void *ctxt, 
    const xmlChar *name, 
    const xmlChar *ns_uri);  
Discussion

xmlXPathVariableLookupFunc: @ctxt: an XPath context @name: name of the variable @ns_uri: the namespace name hosting this variable

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

Returns the XPath object value or NULL if not found.

Structs and Unions


_xmlXPathContext


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

xmlXPathContext:

Expression evaluation occurs with respect to a context. he context consists of: - a node (the context node) - a node list (the context node list) - a set of variable bindings - a function library - the set of namespace declarations in scope for the expression Following the switch to hash tables, this need to be trimmed up at the next binary incompatible release.


_xmlXPathParserContext


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

xmlXPathParserContext:

An XPath parser context. It contains pure parsing informations, an xmlXPathContext, and the stack of objects.

Globals


XMLPUBFUN


 Macros which declare an exportable function */
#define XMLPUBFUN  ;  
Discussion

Conversion functions to basic types.


XMLPUBFUN


 Macros which declare an exportable function */
#define XMLPUBFUN  ;  
Discussion

Context handling.


XMLPUBFUN


 Macros which declare an exportable function */
#define XMLPUBFUN  ;  
Discussion

Evaluation functions.


XMLPUBFUN


 Macros which declare an exportable function */
#define XMLPUBFUN  ;  
Discussion

Separate compilation/evaluation entry points.


xmlXPathNAN


extern  double xmlXPathNAN;  
Discussion

Objects and Nodesets handling

#defines


xmlXPathNodeSetGetLength


#define xmlXPathNodeSetGetLength(
    ns)  
Discussion

xmlXPathNodeSetGetLength: @ns: a node-set

Implement a functionality similar to the DOM NodeList.length.

Returns the number of nodes in the node-set.


xmlXPathNodeSetIsEmpty


#define xmlXPathNodeSetIsEmpty(
    ns) \ (((
    ns) == NULL) || ((
    ns)->nodeNr == 0) || ((
    ns)->nodeTab == NULL)) 
Discussion

xmlXPathNodeSetIsEmpty: @ns: a node-set

Checks whether @ns is empty or not.

Returns %TRUE if @ns is an empty node-set.


xmlXPathNodeSetItem


#define xmlXPathNodeSetItem(
    ns, index) \ ((((
    ns) != NULL) && \ ((
    index) >= 0) && ((
    index) < (
    ns)->nodeNr)) ? \ (
    ns)->nodeTab[(
    index)] \ : NULL) 
Discussion

xmlXPathNodeSetItem: @ns: a node-set @index: index of a node in the set

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)

Last Updated: 2006-06-20