/*
* Summary: XML Path Language implementation
* Description: 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
*
* Implements
* W3C Recommendation 16 November 1999
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XPATH_H__
#define __XML_XPATH_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_XPATH_ENABLED
#include <libxml/xmlerror.h>
#endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
#ifdef __cplusplus
extern "C" {
#endif
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_XPATH_ENABLED
/**
* The set of XPath error codes.
*/
typedef enum {
XPATH_EXPRESSION_OK = 0,
/*
* A node-set (an unordered collection of nodes without duplicates).
*/
struct _xmlNodeSet {
/* @@ with_ns to check wether namespace nodes should be looked at @@ */
};
/*
* An expression is evaluated to yield an object, which
* has one of the following four basic types:
* - node-set
* - boolean
* - number
* - string
*
* @@ XPointer will add more types !
*/
typedef enum {
XPATH_UNDEFINED = 0,
struct _xmlXPathObject {
int boolval;
double floatval;
void *user;
int index;
void *user2;
int index2;
};
/**
* 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
*/
/*
* Extra type: a name and a conversion function.
*/
struct _xmlXPathType {
};
/*
* Extra variable: a name and a value.
*/
struct _xmlXPathVariable {
};
/**
* 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.
*/
int nargs);
/*
* Extra function: a name and a evaluation function.
*/
struct _xmlXPathFunct {
};
/**
* 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.
*/
/*
* Extra axis: a name and an axis function.
*/
struct _xmlXPathAxis {
};
/**
* 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.
*/
/*
* Function and Variable Lookup.
*/
/**
* 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.
*/
/**
* 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.
*/
/**
* xmlXPathFlags:
* Flags for XPath engine compilation and runtime
*/
/**
* XML_XPATH_CHECKNS:
*
* check namespaces at compilation
*/
/**
* XML_XPATH_NOVAR:
*
* forbid variables in expression
*/
/**
* 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 _xmlXPathContext {
/* the namespace nodes of the context node */
/* extra variables */
/* extra stuff for XPointer */
/* the set of namespace declarations in scope for the expression */
/* Possibility to link in an extra item */
/* The function name and URI when calling a function */
/* function lookup function and data */
/* temporary namespace lists kept for walking the namespace axis */
/* error reporting mechanism */
/* dictionary */
/* Cache for reusal of XPath objects */
void *cache;
};
/*
* The structure of a compiled expression form is not public.
*/
/**
* xmlXPathParserContext:
*
* An XPath parser context. It contains pure parsing informations,
* an xmlXPathContext, and the stack of objects.
*/
struct _xmlXPathParserContext {
};
/************************************************************************
* *
* Public API *
* *
************************************************************************/
/**
* Objects and Nodesets handling
*/
/* These macros may later turn into functions */
/**
* xmlXPathNodeSetGetLength:
* @ns: a node-set
*
* Implement a functionality similar to the DOM NodeList.length.
*
* Returns the number of nodes in the node-set.
*/
/**
* 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)
*/
: NULL)
/**
* xmlXPathNodeSetIsEmpty:
* @ns: a node-set
*
* Checks whether @ns is empty or not.
*
* Returns %TRUE if @ns is an empty node-set.
*/
/**
* Conversion functions to basic types.
*/
xmlXPathCastNumberToBoolean (double val);
xmlXPathCastBooleanToNumber (int val);
xmlXPathCastBooleanToString (int val);
xmlXPathCastNumberToString (double val);
/**
* Context handling.
*/
int active,
int value,
int options);
/**
* Evaluation functions.
*/
/**
* Separate compilation/evaluation entry points.
*/
#endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
xmlXPathInit (void);
xmlXPathIsNaN (double val);
xmlXPathIsInf (double val);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
#endif /* ! __XML_XPATH_H__ */