Introduction
Typedefs
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.
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
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.
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.
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.
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.
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
struct _xmlXPathContext {
xmlDocPtr doc;
xmlNodePtr node;
int nb_variables_unused;
int max_variables_unused;
xmlHashTablePtr varHash;
int nb_types;
int max_types;
xmlXPathTypePtr types;
int nb_funcs_unused;
int max_funcs_unused;
xmlHashTablePtr funcHash;
int nb_axis;
int max_axis;
xmlXPathAxisPtr axis;
xmlNsPtr *namespaces;
int nsNr;
void *user;
int contextSize;
int proximityPosition;
int xptr;
xmlNodePtr here;
xmlNodePtr origin;
xmlHashTablePtr nsHash;
xmlXPathVariableLookupFunc varLookupFunc;
void *varLookupData;
void *extra;
const xmlChar *function;
const xmlChar *functionURI;
xmlXPathFuncLookupFunc funcLookupFunc;
void *funcLookupData;
xmlNsPtr *tmpNsList;
int tmpNsNr;
void *userData;
xmlStructuredErrorFunc error;
xmlError lastError;
xmlNodePtr debugNode;
xmlDictPtr dict;
};
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.
struct _xmlXPathParserContext {
const xmlChar *cur;
const xmlChar *base;
int error;
xmlXPathContextPtr context;
xmlXPathObjectPtr value;
int valueNr;
int valueMax;
xmlXPathObjectPtr *valueTab;
xmlXPathCompExprPtr comp;
int xptr;
xmlNodePtr ancestor;
};
Discussion
xmlXPathParserContext:
An XPath parser context. It contains pure parsing informations,
an xmlXPathContext, and the stack of objects.
Globals
Macros which declare an exportable function */
#define XMLPUBFUN ;
Discussion
Conversion functions to basic types.
Macros which declare an exportable function */
#define XMLPUBFUN ;
Discussion
Context handling.
Macros which declare an exportable function */
#define XMLPUBFUN ;
Discussion
Evaluation functions.
Macros which declare an exportable function */
#define XMLPUBFUN ;
Discussion
Separate compilation/evaluation entry points.
extern double xmlXPathNAN;
Discussion
Objects and Nodesets handling
#defines
#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.
#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.
#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)
|
Did this document help you? |
Yes: Tell us what works for you.
|
|
Last Updated: 2006-06-20