xpath

xpath - XML Path Language implementation

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

Author(s): Daniel Veillard

Synopsis

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

Description

Details

Macro XML_XPATH_CHECKNS

#define XML_XPATH_CHECKNS;

check namespaces at compilation


Macro XML_XPATH_NOVAR

#define XML_XPATH_NOVAR;

forbid variables in expression


Macro xmlXPathNodeSetGetLength

#define xmlXPathNodeSetGetLength(ns);

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

ns:a node-set

Macro xmlXPathNodeSetIsEmpty

#define xmlXPathNodeSetIsEmpty(ns);

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

ns:a node-set

Macro xmlXPathNodeSetItem

#define xmlXPathNodeSetItem(ns, index);

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)

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

Structure xmlNodeSet

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


Typedef xmlNodeSetPtr

xmlNodeSet * xmlNodeSetPtr;


Structure xmlXPathAxis

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


Typedef xmlXPathAxisPtr

xmlXPathAxis * xmlXPathAxisPtr;


Structure xmlXPathCompExpr

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


Typedef xmlXPathCompExprPtr

xmlXPathCompExpr * xmlXPathCompExprPtr;


Structure 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	: is this an XPointer context?
    xmlNodePtr	here	: for here()
    xmlNodePtr	origin	: for origin() the set of namespace declarations in scope for the expre
    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 n
    xmlNsPtr *	tmpNsList	: Array of namespaces
    int	tmpNsNr	: number of namespaces 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 dictionary
    xmlDictPtr	dict	: dictionary if any
    int	flags	: flags to control compilation Cache for reusal of XPath objects
    void *	cache	: Resource limits
    unsigned long	opLimit
    unsigned long	opCount
    int	depth
    int	maxDepth
    int	maxParserDepth
} xmlXPathContext;


Typedef xmlXPathContextPtr

xmlXPathContext * xmlXPathContextPtr;



Typedef xmlXPathFuncPtr

xmlXPathFunct * xmlXPathFuncPtr;


Structure xmlXPathFunct

struct _xmlXPathFunct {
    const