Annotation of XML/xpath.h, revision 1.1
1.1 ! daniel 1: /*
! 2: * xpath.c: interface for XML Path Language implementation
! 3: *
! 4: * Reference: W3C Working Draft 5 July 1999
! 5: * http://www.w3.org/Style/XSL/Group/1999/07/xpath-19990705.html
! 6: *
! 7: * See COPYRIGHT for the status of this software
! 8: *
! 9: * Author: Daniel.Veillard@w3.org
! 10: */
! 11:
! 12: #ifndef __XML_XPATH_H__
! 13: #define __XML_XPATH_H__
! 14:
! 15: #include "tree.h"
! 16:
! 17: /*
! 18: * A node-set (an unordered collection of nodes without duplicates)
! 19: */
! 20: typedef struct xmlNodeSet {
! 21: int nodeNr; /* # of node in the set */
! 22: int nodeMax; /* allocated space */
! 23: xmlNodePtr *nodeTab; /* array of nodes in no particular order */
! 24: } xmlNodeSet, *xmlNodeSetPtr;
! 25:
! 26: /*
! 27: * An expression is evaluated to yield an object, which
! 28: * has one of the following four basic types:
! 29: * - node-set
! 30: * - boolean
! 31: * - number
! 32: * - string
! 33: */
! 34:
! 35: #define XPATH_UNDEFINED 0
! 36: #define XPATH_NODESET 1
! 37: #define XPATH_BOOLEAN 2
! 38: #define XPATH_NUMBER 3
! 39: #define XPATH_STRING 4
! 40:
! 41: typedef struct xmlXPathObject {
! 42: int type;
! 43: xmlNodeSetPtr nodesetval;
! 44: int boolval;
! 45: float floatval;
! 46: CHAR *stringval;
! 47: } xmlXPathObject, *xmlXPathObjectPtr;
! 48:
! 49: /*
! 50: * Expression evaluation occurs with respect to a context.
! 51: * he context consists of:
! 52: * - a node (the context node)
! 53: * - a node list (the context node list)
! 54: * - a set of variable bindings
! 55: * - a function library
! 56: * - the set of namespace declarations in scope for the expression
! 57: */
! 58:
! 59: typedef struct xmlXPathContext {
! 60: xmlNodePtr node;
! 61: xmlNodeSetPtr nodelist;
! 62: void *variables; /* TODO !!!! */
! 63: void *functions; /* TODO !!!! */
! 64: void *namespaces; /* TODO !!!! */
! 65: } xmlXPathContext, *xmlXPathContextPtr;
! 66:
! 67: /*
! 68: * An XPath parser context, it contains pure parsing informations,
! 69: * an xmlXPathContext, and the stack of objects.
! 70: */
! 71: typedef struct xmlXPathParserContext {
! 72: const CHAR *cur; /* the current char being parsed */
! 73: const CHAR *base; /* the full expression */
! 74:
! 75: int error; /* error code */
! 76:
! 77: xmlXPathContextPtr context; /* the evaluation context */
! 78: xmlXPathObjectPtr value; /* the current value */
! 79: int valueNr; /* number of values stacked */
! 80: int valueMax; /* max number of values stacked */
! 81: xmlXPathObjectPtr *valueTab; /* stack of values */
! 82: } xmlXPathParserContext, *xmlXPathParserContextPtr;
! 83:
! 84: /*
! 85: * An XPath function
! 86: * The arguments (if any) are popped out of the context stack
! 87: * and the result is pushed on the stack.
! 88: */
! 89:
! 90: typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt);
! 91:
! 92: /************************************************************************
! 93: * *
! 94: * Public API *
! 95: * *
! 96: ************************************************************************/
! 97:
! 98: xmlXPathContextPtr xmlXPathNewContext(void *variables, void *functions,
! 99: void *namespaces);
! 100: void xmlXPathFreeContext(xmlXPathContextPtr ctxt);
! 101: #endif /* ! __XML_XPATH_H__ */
Webmaster