123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546 |
- #ifndef __XML_XPATH_H__
- #define __XML_XPATH_H__
- #include <libxml/xmlversion.h>
- #ifdef LIBXML_XPATH_ENABLED
- #include <libxml/xmlerror.h>
- #include <libxml/tree.h>
- #include <libxml/hash.h>
- #endif
- #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
- #ifdef __cplusplus
- extern "C" {
- #endif
- #endif
-
- #ifdef LIBXML_XPATH_ENABLED
- typedef struct _xmlXPathContext xmlXPathContext;
- typedef xmlXPathContext *xmlXPathContextPtr;
- typedef struct _xmlXPathParserContext xmlXPathParserContext;
- typedef xmlXPathParserContext *xmlXPathParserContextPtr;
- 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;
- typedef struct _xmlNodeSet xmlNodeSet;
- typedef xmlNodeSet *xmlNodeSetPtr;
- struct _xmlNodeSet {
- int nodeNr;
- int nodeMax;
- xmlNodePtr *nodeTab;
-
- };
- typedef enum {
- XPATH_UNDEFINED = 0,
- XPATH_NODESET = 1,
- XPATH_BOOLEAN = 2,
- XPATH_NUMBER = 3,
- XPATH_STRING = 4,
- XPATH_POINT = 5,
- XPATH_RANGE = 6,
- XPATH_LOCATIONSET = 7,
- XPATH_USERS = 8,
- XPATH_XSLT_TREE = 9
- } xmlXPathObjectType;
- typedef struct _xmlXPathObject xmlXPathObject;
- typedef xmlXPathObject *xmlXPathObjectPtr;
- struct _xmlXPathObject {
- xmlXPathObjectType type;
- xmlNodeSetPtr nodesetval;
- int boolval;
- double floatval;
- xmlChar *stringval;
- void *user;
- int index;
- void *user2;
- int index2;
- };
- typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
- typedef struct _xmlXPathType xmlXPathType;
- typedef xmlXPathType *xmlXPathTypePtr;
- struct _xmlXPathType {
- const xmlChar *name;
- xmlXPathConvertFunc func;
- };
- typedef struct _xmlXPathVariable xmlXPathVariable;
- typedef xmlXPathVariable *xmlXPathVariablePtr;
- struct _xmlXPathVariable {
- const xmlChar *name;
- xmlXPathObjectPtr value;
- };
- typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
- int nargs);
- typedef struct _xmlXPathFunct xmlXPathFunct;
- typedef xmlXPathFunct *xmlXPathFuncPtr;
- struct _xmlXPathFunct {
- const xmlChar *name;
- xmlXPathEvalFunc func;
- };
- typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
- xmlXPathObjectPtr cur);
- typedef struct _xmlXPathAxis xmlXPathAxis;
- typedef xmlXPathAxis *xmlXPathAxisPtr;
- struct _xmlXPathAxis {
- const xmlChar *name;
- xmlXPathAxisFunc func;
- };
- typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
- typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
- const xmlChar *name,
- const xmlChar *ns_uri);
- typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
- const xmlChar *name,
- const xmlChar *ns_uri);
- #define XML_XPATH_CHECKNS (1<<0)
- #define XML_XPATH_NOVAR (1<<1)
- 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;
- int flags;
-
- void *cache;
- };
- typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
- typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
- 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;
- };
- XMLPUBVAR double xmlXPathNAN;
- XMLPUBVAR double xmlXPathPINF;
- XMLPUBVAR double xmlXPathNINF;
- #define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
- #define xmlXPathNodeSetItem(ns, index) \
- ((((ns) != NULL) && \
- ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
- (ns)->nodeTab[(index)] \
- : NULL)
- #define xmlXPathNodeSetIsEmpty(ns) \
- (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
- XMLPUBFUN void XMLCALL
- xmlXPathFreeObject (xmlXPathObjectPtr obj);
- XMLPUBFUN xmlNodeSetPtr XMLCALL
- xmlXPathNodeSetCreate (xmlNodePtr val);
- XMLPUBFUN void XMLCALL
- xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
- XMLPUBFUN void XMLCALL
- xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
- XMLPUBFUN xmlXPathObjectPtr XMLCALL
- xmlXPathObjectCopy (xmlXPathObjectPtr val);
- XMLPUBFUN int XMLCALL
- xmlXPathCmpNodes (xmlNodePtr node1,
- xmlNodePtr node2);
- XMLPUBFUN int XMLCALL
- xmlXPathCastNumberToBoolean (double val);
- XMLPUBFUN int XMLCALL
- xmlXPathCastStringToBoolean (const xmlChar * val);
- XMLPUBFUN int XMLCALL
- xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
- XMLPUBFUN int XMLCALL
- xmlXPathCastToBoolean (xmlXPathObjectPtr val);
- XMLPUBFUN double XMLCALL
- xmlXPathCastBooleanToNumber (int val);
- XMLPUBFUN double XMLCALL
- xmlXPathCastStringToNumber (const xmlChar * val);
- XMLPUBFUN double XMLCALL
- xmlXPathCastNodeToNumber (xmlNodePtr node);
- XMLPUBFUN double XMLCALL
- xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
- XMLPUBFUN double XMLCALL
- xmlXPathCastToNumber (xmlXPathObjectPtr val);
- XMLPUBFUN xmlChar * XMLCALL
- xmlXPathCastBooleanToString (int val);
- XMLPUBFUN xmlChar * XMLCALL
- xmlXPathCastNumberToString (double val);
- XMLPUBFUN xmlChar * XMLCALL
- xmlXPathCastNodeToString (xmlNodePtr node);
- XMLPUBFUN xmlChar * XMLCALL
- xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
- XMLPUBFUN xmlChar * XMLCALL
- xmlXPathCastToString (xmlXPathObjectPtr val);
- XMLPUBFUN xmlXPathObjectPtr XMLCALL
- xmlXPathConvertBoolean (xmlXPathObjectPtr val);
- XMLPUBFUN xmlXPathObjectPtr XMLCALL
- xmlXPathConvertNumber (xmlXPathObjectPtr val);
- XMLPUBFUN xmlXPathObjectPtr XMLCALL
- xmlXPathConvertString (xmlXPathObjectPtr val);
- XMLPUBFUN xmlXPathContextPtr XMLCALL
- xmlXPathNewContext (xmlDocPtr doc);
- XMLPUBFUN void XMLCALL
- xmlXPathFreeContext (xmlXPathContextPtr ctxt);
- XMLPUBFUN int XMLCALL
- xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
- int active,
- int value,
- int options);
- XMLPUBFUN long XMLCALL
- xmlXPathOrderDocElems (xmlDocPtr doc);
- XMLPUBFUN xmlXPathObjectPtr XMLCALL
- xmlXPathEval (const xmlChar *str,
- xmlXPathContextPtr ctx);
- XMLPUBFUN xmlXPathObjectPtr XMLCALL
- xmlXPathEvalExpression (const xmlChar *str,
- xmlXPathContextPtr ctxt);
- XMLPUBFUN int XMLCALL
- xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
- xmlXPathObjectPtr res);
- XMLPUBFUN xmlXPathCompExprPtr XMLCALL
- xmlXPathCompile (const xmlChar *str);
- XMLPUBFUN xmlXPathCompExprPtr XMLCALL
- xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
- const xmlChar *str);
- XMLPUBFUN xmlXPathObjectPtr XMLCALL
- xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
- xmlXPathContextPtr ctx);
- XMLPUBFUN int XMLCALL
- xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
- xmlXPathContextPtr ctxt);
- XMLPUBFUN void XMLCALL
- xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
- #endif
- #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
- XMLPUBFUN void XMLCALL
- xmlXPathInit (void);
- XMLPUBFUN int XMLCALL
- xmlXPathIsNaN (double val);
- XMLPUBFUN int XMLCALL
- xmlXPathIsInf (double val);
- #ifdef __cplusplus
- }
- #endif
- #endif
- #endif
|