mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
(libxml2) Remove XPath/ Xpointer
This commit is contained in:
parent
f459819813
commit
9f123a54d9
@ -47,7 +47,6 @@ LOCAL_LIBXML_SRC_FILES = $(LIBXML_PATH)/c14n.c \
|
|||||||
$(LIBXML_PATH)/uri.c \
|
$(LIBXML_PATH)/uri.c \
|
||||||
$(LIBXML_PATH)/valid.c \
|
$(LIBXML_PATH)/valid.c \
|
||||||
$(LIBXML_PATH)/xinclude.c \
|
$(LIBXML_PATH)/xinclude.c \
|
||||||
$(LIBXML_PATH)/xlink.c \
|
|
||||||
$(LIBXML_PATH)/xmlIO.c \
|
$(LIBXML_PATH)/xmlIO.c \
|
||||||
$(LIBXML_PATH)/xmlmemory.c \
|
$(LIBXML_PATH)/xmlmemory.c \
|
||||||
$(LIBXML_PATH)/xmlmodule.c \
|
$(LIBXML_PATH)/xmlmodule.c \
|
||||||
@ -58,9 +57,7 @@ LOCAL_LIBXML_SRC_FILES = $(LIBXML_PATH)/c14n.c \
|
|||||||
$(LIBXML_PATH)/xmlschemastypes.c \
|
$(LIBXML_PATH)/xmlschemastypes.c \
|
||||||
$(LIBXML_PATH)/xmlstring.c \
|
$(LIBXML_PATH)/xmlstring.c \
|
||||||
$(LIBXML_PATH)/xmlunicode.c \
|
$(LIBXML_PATH)/xmlunicode.c \
|
||||||
$(LIBXML_PATH)/xmlwriter.c \
|
$(LIBXML_PATH)/xmlwriter.c
|
||||||
$(LIBXML_PATH)/xpath.c \
|
|
||||||
$(LIBXML_PATH)/xpointer.c
|
|
||||||
LOCAL_SRC_FILES = $(RARCH_PATH)/console/griffin/griffin.c $(LOCAL_LIBXML_SRC_FILES)
|
LOCAL_SRC_FILES = $(RARCH_PATH)/console/griffin/griffin.c $(LOCAL_LIBXML_SRC_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -613,7 +613,7 @@ struct _xmlDOMWrapCtxt {
|
|||||||
/*
|
/*
|
||||||
* Some helper functions
|
* Some helper functions
|
||||||
*/
|
*/
|
||||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
||||||
XMLPUBFUN int XMLCALL
|
XMLPUBFUN int XMLCALL
|
||||||
xmlValidateNCName (const xmlChar *value,
|
xmlValidateNCName (const xmlChar *value,
|
||||||
int space);
|
int space);
|
||||||
@ -943,11 +943,11 @@ XMLPUBFUN xmlNsPtr XMLCALL
|
|||||||
xmlSearchNsByHref (xmlDocPtr doc,
|
xmlSearchNsByHref (xmlDocPtr doc,
|
||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
const xmlChar *href);
|
const xmlChar *href);
|
||||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||||
XMLPUBFUN xmlNsPtr * XMLCALL
|
XMLPUBFUN xmlNsPtr * XMLCALL
|
||||||
xmlGetNsList (xmlDocPtr doc,
|
xmlGetNsList (xmlDocPtr doc,
|
||||||
xmlNodePtr node);
|
xmlNodePtr node);
|
||||||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
|
#endif /* defined(LIBXML_TREE_ENABLED) */
|
||||||
|
|
||||||
XMLPUBFUN void XMLCALL
|
XMLPUBFUN void XMLCALL
|
||||||
xmlSetNs (xmlNodePtr node,
|
xmlSetNs (xmlNodePtr node,
|
||||||
|
@ -13,177 +13,5 @@
|
|||||||
#include <libxml/xmlversion.h>
|
#include <libxml/xmlversion.h>
|
||||||
#include <libxml/tree.h>
|
#include <libxml/tree.h>
|
||||||
|
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Various defines for the various Link properties.
|
|
||||||
*
|
|
||||||
* NOTE: the link detection layer will try to resolve QName expansion
|
|
||||||
* of namespaces. If "foo" is the prefix for "http://foo.com/"
|
|
||||||
* then the link detection layer will expand role="foo:myrole"
|
|
||||||
* to "http://foo.com/:myrole".
|
|
||||||
* NOTE: the link detection layer will expand URI-Refences found on
|
|
||||||
* href attributes by using the base mechanism if found.
|
|
||||||
*/
|
|
||||||
typedef xmlChar *xlinkHRef;
|
|
||||||
typedef xmlChar *xlinkRole;
|
|
||||||
typedef xmlChar *xlinkTitle;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
XLINK_TYPE_NONE = 0,
|
|
||||||
XLINK_TYPE_SIMPLE,
|
|
||||||
XLINK_TYPE_EXTENDED,
|
|
||||||
XLINK_TYPE_EXTENDED_SET
|
|
||||||
} xlinkType;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
XLINK_SHOW_NONE = 0,
|
|
||||||
XLINK_SHOW_NEW,
|
|
||||||
XLINK_SHOW_EMBED,
|
|
||||||
XLINK_SHOW_REPLACE
|
|
||||||
} xlinkShow;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
XLINK_ACTUATE_NONE = 0,
|
|
||||||
XLINK_ACTUATE_AUTO,
|
|
||||||
XLINK_ACTUATE_ONREQUEST
|
|
||||||
} xlinkActuate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkNodeDetectFunc:
|
|
||||||
* @ctx: user data pointer
|
|
||||||
* @node: the node to check
|
|
||||||
*
|
|
||||||
* This is the prototype for the link detection routine.
|
|
||||||
* It calls the default link detection callbacks upon link detection.
|
|
||||||
*/
|
|
||||||
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The link detection module interact with the upper layers using
|
|
||||||
* a set of callback registered at parsing time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkSimpleLinkFunk:
|
|
||||||
* @ctx: user data pointer
|
|
||||||
* @node: the node carrying the link
|
|
||||||
* @href: the target of the link
|
|
||||||
* @role: the role string
|
|
||||||
* @title: the link title
|
|
||||||
*
|
|
||||||
* This is the prototype for a simple link detection callback.
|
|
||||||
*/
|
|
||||||
typedef void
|
|
||||||
(*xlinkSimpleLinkFunk) (void *ctx,
|
|
||||||
xmlNodePtr node,
|
|
||||||
const xlinkHRef href,
|
|
||||||
const xlinkRole role,
|
|
||||||
const xlinkTitle title);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkExtendedLinkFunk:
|
|
||||||
* @ctx: user data pointer
|
|
||||||
* @node: the node carrying the link
|
|
||||||
* @nbLocators: the number of locators detected on the link
|
|
||||||
* @hrefs: pointer to the array of locator hrefs
|
|
||||||
* @roles: pointer to the array of locator roles
|
|
||||||
* @nbArcs: the number of arcs detected on the link
|
|
||||||
* @from: pointer to the array of source roles found on the arcs
|
|
||||||
* @to: pointer to the array of target roles found on the arcs
|
|
||||||
* @show: array of values for the show attributes found on the arcs
|
|
||||||
* @actuate: array of values for the actuate attributes found on the arcs
|
|
||||||
* @nbTitles: the number of titles detected on the link
|
|
||||||
* @title: array of titles detected on the link
|
|
||||||
* @langs: array of xml:lang values for the titles
|
|
||||||
*
|
|
||||||
* This is the prototype for a extended link detection callback.
|
|
||||||
*/
|
|
||||||
typedef void
|
|
||||||
(*xlinkExtendedLinkFunk)(void *ctx,
|
|
||||||
xmlNodePtr node,
|
|
||||||
int nbLocators,
|
|
||||||
const xlinkHRef *hrefs,
|
|
||||||
const xlinkRole *roles,
|
|
||||||
int nbArcs,
|
|
||||||
const xlinkRole *from,
|
|
||||||
const xlinkRole *to,
|
|
||||||
xlinkShow *show,
|
|
||||||
xlinkActuate *actuate,
|
|
||||||
int nbTitles,
|
|
||||||
const xlinkTitle *titles,
|
|
||||||
const xmlChar **langs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkExtendedLinkSetFunk:
|
|
||||||
* @ctx: user data pointer
|
|
||||||
* @node: the node carrying the link
|
|
||||||
* @nbLocators: the number of locators detected on the link
|
|
||||||
* @hrefs: pointer to the array of locator hrefs
|
|
||||||
* @roles: pointer to the array of locator roles
|
|
||||||
* @nbTitles: the number of titles detected on the link
|
|
||||||
* @title: array of titles detected on the link
|
|
||||||
* @langs: array of xml:lang values for the titles
|
|
||||||
*
|
|
||||||
* This is the prototype for a extended link set detection callback.
|
|
||||||
*/
|
|
||||||
typedef void
|
|
||||||
(*xlinkExtendedLinkSetFunk) (void *ctx,
|
|
||||||
xmlNodePtr node,
|
|
||||||
int nbLocators,
|
|
||||||
const xlinkHRef *hrefs,
|
|
||||||
const xlinkRole *roles,
|
|
||||||
int nbTitles,
|
|
||||||
const xlinkTitle *titles,
|
|
||||||
const xmlChar **langs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the structure containing a set of Links detection callbacks.
|
|
||||||
*
|
|
||||||
* There is no default xlink callbacks, if one want to get link
|
|
||||||
* recognition activated, those call backs must be provided before parsing.
|
|
||||||
*/
|
|
||||||
typedef struct _xlinkHandler xlinkHandler;
|
|
||||||
typedef xlinkHandler *xlinkHandlerPtr;
|
|
||||||
struct _xlinkHandler {
|
|
||||||
xlinkSimpleLinkFunk simple;
|
|
||||||
xlinkExtendedLinkFunk extended;
|
|
||||||
xlinkExtendedLinkSetFunk set;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The default detection routine, can be overridden, they call the default
|
|
||||||
* detection callbacks.
|
|
||||||
*/
|
|
||||||
|
|
||||||
XMLPUBFUN xlinkNodeDetectFunc XMLCALL
|
|
||||||
xlinkGetDefaultDetect (void);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Routines to set/get the default handlers.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN xlinkHandlerPtr XMLCALL
|
|
||||||
xlinkGetDefaultHandler (void);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xlinkSetDefaultHandler (xlinkHandlerPtr handler);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Link detection module itself.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN xlinkType XMLCALL
|
|
||||||
xlinkIsLink (xmlDocPtr doc,
|
|
||||||
xmlNodePtr node);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* LIBXML_XPTR_ENABLED */
|
|
||||||
|
|
||||||
#endif /* __XML_XLINK_H__ */
|
#endif /* __XML_XLINK_H__ */
|
||||||
|
@ -178,24 +178,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|||||||
#define LIBXML_C14N_ENABLED
|
#define LIBXML_C14N_ENABLED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* LIBXML_XPATH_ENABLED:
|
|
||||||
*
|
|
||||||
* Whether XPath is configured in
|
|
||||||
*/
|
|
||||||
#if 1
|
|
||||||
#define LIBXML_XPATH_ENABLED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LIBXML_XPTR_ENABLED:
|
|
||||||
*
|
|
||||||
* Whether XPointer is configured in
|
|
||||||
*/
|
|
||||||
#if 1
|
|
||||||
#define LIBXML_XPTR_ENABLED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIBXML_XINCLUDE_ENABLED:
|
* LIBXML_XINCLUDE_ENABLED:
|
||||||
*
|
*
|
||||||
|
@ -21,529 +21,4 @@
|
|||||||
|
|
||||||
#include <libxml/xmlversion.h>
|
#include <libxml/xmlversion.h>
|
||||||
|
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
|
|
||||||
#include <libxml/xmlerror.h>
|
|
||||||
#include <libxml/tree.h>
|
|
||||||
#include <libxml/hash.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
|
|
||||||
|
|
||||||
typedef struct _xmlXPathContext xmlXPathContext;
|
|
||||||
typedef xmlXPathContext *xmlXPathContextPtr;
|
|
||||||
typedef struct _xmlXPathParserContext xmlXPathParserContext;
|
|
||||||
typedef xmlXPathParserContext *xmlXPathParserContextPtr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The set of XPath error codes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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,
|
|
||||||
XPATH_STACK_ERROR
|
|
||||||
} xmlXPathError;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A node-set (an unordered collection of nodes without duplicates).
|
|
||||||
*/
|
|
||||||
typedef struct _xmlNodeSet xmlNodeSet;
|
|
||||||
typedef xmlNodeSet *xmlNodeSetPtr;
|
|
||||||
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 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,
|
|
||||||
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 /* An XSLT value tree, non modifiable */
|
|
||||||
} 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Extra type: a name and a conversion function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct _xmlXPathType xmlXPathType;
|
|
||||||
typedef xmlXPathType *xmlXPathTypePtr;
|
|
||||||
struct _xmlXPathType {
|
|
||||||
const xmlChar *name; /* the type name */
|
|
||||||
xmlXPathConvertFunc func; /* the conversion function */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Extra variable: a name and a value.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct _xmlXPathVariable xmlXPathVariable;
|
|
||||||
typedef xmlXPathVariable *xmlXPathVariablePtr;
|
|
||||||
struct _xmlXPathVariable {
|
|
||||||
const xmlChar *name; /* the variable name */
|
|
||||||
xmlXPathObjectPtr value; /* the value */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
|
|
||||||
int nargs);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Extra function: a name and a evaluation function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct _xmlXPathFunct xmlXPathFunct;
|
|
||||||
typedef xmlXPathFunct *xmlXPathFuncPtr;
|
|
||||||
struct _xmlXPathFunct {
|
|
||||||
const xmlChar *name; /* the function name */
|
|
||||||
xmlXPathEvalFunc func; /* the evaluation function */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlXPathObjectPtr cur);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Extra axis: a name and an axis function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct _xmlXPathAxis xmlXPathAxis;
|
|
||||||
typedef xmlXPathAxis *xmlXPathAxisPtr;
|
|
||||||
struct _xmlXPathAxis {
|
|
||||||
const xmlChar *name; /* the axis name */
|
|
||||||
xmlXPathAxisFunc func; /* the search function */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
|
|
||||||
const xmlChar *name,
|
|
||||||
const xmlChar *ns_uri);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
|
|
||||||
const xmlChar *name,
|
|
||||||
const xmlChar *ns_uri);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathFlags:
|
|
||||||
* Flags for XPath engine compilation and runtime
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* XML_XPATH_CHECKNS:
|
|
||||||
*
|
|
||||||
* check namespaces at compilation
|
|
||||||
*/
|
|
||||||
#define XML_XPATH_CHECKNS (1<<0)
|
|
||||||
/**
|
|
||||||
* XML_XPATH_NOVAR:
|
|
||||||
*
|
|
||||||
* forbid variables in expression
|
|
||||||
*/
|
|
||||||
#define XML_XPATH_NOVAR (1<<1)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
* The node may be modified when the context is passed to libxml2
|
|
||||||
* for an XPath evaluation so you may need to initialize it again
|
|
||||||
* before the next call.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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 expression */
|
|
||||||
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 namespace axis */
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The structure of a compiled expression form is not public.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
|
|
||||||
typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathParserContext:
|
|
||||||
*
|
|
||||||
* An XPath parser context. It contains pure parsing informations,
|
|
||||||
* an xmlXPathContext, and the stack of objects.
|
|
||||||
*/
|
|
||||||
struct _xmlXPathParserContext {
|
|
||||||
const xmlChar *cur; /* the current char being parsed */
|
|
||||||
const xmlChar *base; /* the full expression */
|
|
||||||
|
|
||||||
int error; /* error code */
|
|
||||||
|
|
||||||
xmlXPathContextPtr context; /* the evaluation context */
|
|
||||||
xmlXPathObjectPtr value; /* the current value */
|
|
||||||
int valueNr; /* number of values stacked */
|
|
||||||
int valueMax; /* max number of values stacked */
|
|
||||||
xmlXPathObjectPtr *valueTab; /* stack of values */
|
|
||||||
|
|
||||||
xmlXPathCompExprPtr comp; /* the precompiled expression */
|
|
||||||
int xptr; /* it this an XPointer expression */
|
|
||||||
xmlNodePtr ancestor; /* used for walking preceding axis */
|
|
||||||
|
|
||||||
int valueFrame; /* used to limit Pop on the stack */
|
|
||||||
};
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* *
|
|
||||||
* Public API *
|
|
||||||
* *
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Objects and Nodesets handling
|
|
||||||
*/
|
|
||||||
|
|
||||||
XMLPUBVAR double xmlXPathNAN;
|
|
||||||
XMLPUBVAR double xmlXPathPINF;
|
|
||||||
XMLPUBVAR double xmlXPathNINF;
|
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
*/
|
|
||||||
#define xmlXPathNodeSetItem(ns, index) \
|
|
||||||
((((ns) != NULL) && \
|
|
||||||
((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
|
|
||||||
(ns)->nodeTab[(index)] \
|
|
||||||
: NULL)
|
|
||||||
/**
|
|
||||||
* xmlXPathNodeSetIsEmpty:
|
|
||||||
* @ns: a node-set
|
|
||||||
*
|
|
||||||
* Checks whether @ns is empty or not.
|
|
||||||
*
|
|
||||||
* Returns %TRUE if @ns is an empty node-set.
|
|
||||||
*/
|
|
||||||
#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);
|
|
||||||
/**
|
|
||||||
* Conversion functions to basic types.
|
|
||||||
*/
|
|
||||||
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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Context handling.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN xmlXPathContextPtr XMLCALL
|
|
||||||
xmlXPathNewContext (xmlDocPtr doc);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathFreeContext (xmlXPathContextPtr ctxt);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
|
|
||||||
int active,
|
|
||||||
int value,
|
|
||||||
int options);
|
|
||||||
/**
|
|
||||||
* Evaluation functions.
|
|
||||||
*/
|
|
||||||
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);
|
|
||||||
/**
|
|
||||||
* Separate compilation/evaluation entry points.
|
|
||||||
*/
|
|
||||||
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 /* LIBXML_XPATH_ENABLED */
|
|
||||||
#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 /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
|
|
||||||
#endif /* ! __XML_XPATH_H__ */
|
#endif /* ! __XML_XPATH_H__ */
|
||||||
|
@ -15,606 +15,4 @@
|
|||||||
#include <libxml/xmlversion.h>
|
#include <libxml/xmlversion.h>
|
||||||
#include <libxml/xpath.h>
|
#include <libxml/xpath.h>
|
||||||
|
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* *
|
|
||||||
* Helpers *
|
|
||||||
* *
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Many of these macros may later turn into functions. They
|
|
||||||
* shouldn't be used in #ifdef's preprocessor instructions.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* xmlXPathSetError:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
* @err: an xmlXPathError code
|
|
||||||
*
|
|
||||||
* Raises an error.
|
|
||||||
*/
|
|
||||||
#define xmlXPathSetError(ctxt, err) \
|
|
||||||
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
|
|
||||||
if ((ctxt) != NULL) (ctxt)->error = (err); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathSetArityError:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Raises an XPATH_INVALID_ARITY error.
|
|
||||||
*/
|
|
||||||
#define xmlXPathSetArityError(ctxt) \
|
|
||||||
xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathSetTypeError:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Raises an XPATH_INVALID_TYPE error.
|
|
||||||
*/
|
|
||||||
#define xmlXPathSetTypeError(ctxt) \
|
|
||||||
xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathGetError:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Get the error code of an XPath context.
|
|
||||||
*
|
|
||||||
* Returns the context error.
|
|
||||||
*/
|
|
||||||
#define xmlXPathGetError(ctxt) ((ctxt)->error)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathCheckError:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Check if an XPath error was raised.
|
|
||||||
*
|
|
||||||
* Returns true if an error has been raised, false otherwise.
|
|
||||||
*/
|
|
||||||
#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathGetDocument:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Get the document of an XPath context.
|
|
||||||
*
|
|
||||||
* Returns the context document.
|
|
||||||
*/
|
|
||||||
#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathGetContextNode:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Get the context node of an XPath context.
|
|
||||||
*
|
|
||||||
* Returns the context node.
|
|
||||||
*/
|
|
||||||
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
|
|
||||||
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN double XMLCALL
|
|
||||||
xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlXPathPopString (xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN void * XMLCALL
|
|
||||||
xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnBoolean:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
* @val: a boolean
|
|
||||||
*
|
|
||||||
* Pushes the boolean @val on the context stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnBoolean(ctxt, val) \
|
|
||||||
valuePush((ctxt), xmlXPathNewBoolean(val))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnTrue:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Pushes true on the context stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnFalse:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Pushes false on the context stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnNumber:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
* @val: a double
|
|
||||||
*
|
|
||||||
* Pushes the double @val on the context stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnNumber(ctxt, val) \
|
|
||||||
valuePush((ctxt), xmlXPathNewFloat(val))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnString:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
* @str: a string
|
|
||||||
*
|
|
||||||
* Pushes the string @str on the context stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnString(ctxt, str) \
|
|
||||||
valuePush((ctxt), xmlXPathWrapString(str))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnEmptyString:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Pushes an empty string on the stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnEmptyString(ctxt) \
|
|
||||||
valuePush((ctxt), xmlXPathNewCString(""))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnNodeSet:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
* @ns: a node-set
|
|
||||||
*
|
|
||||||
* Pushes the node-set @ns on the context stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnNodeSet(ctxt, ns) \
|
|
||||||
valuePush((ctxt), xmlXPathWrapNodeSet(ns))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnEmptyNodeSet:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Pushes an empty node-set on the context stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnEmptyNodeSet(ctxt) \
|
|
||||||
valuePush((ctxt), xmlXPathNewNodeSet(NULL))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathReturnExternal:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
* @val: user data
|
|
||||||
*
|
|
||||||
* Pushes user data on the context stack.
|
|
||||||
*/
|
|
||||||
#define xmlXPathReturnExternal(ctxt, val) \
|
|
||||||
valuePush((ctxt), xmlXPathWrapExternal(val))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathStackIsNodeSet:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Check if the current value on the XPath stack is a node set or
|
|
||||||
* an XSLT value tree.
|
|
||||||
*
|
|
||||||
* Returns true if the current object on the stack is a node-set.
|
|
||||||
*/
|
|
||||||
#define xmlXPathStackIsNodeSet(ctxt) \
|
|
||||||
(((ctxt)->value != NULL) \
|
|
||||||
&& (((ctxt)->value->type == XPATH_NODESET) \
|
|
||||||
|| ((ctxt)->value->type == XPATH_XSLT_TREE)))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathStackIsExternal:
|
|
||||||
* @ctxt: an XPath parser context
|
|
||||||
*
|
|
||||||
* Checks if the current value on the XPath stack is an external
|
|
||||||
* object.
|
|
||||||
*
|
|
||||||
* Returns true if the current object on the stack is an external
|
|
||||||
* object.
|
|
||||||
*/
|
|
||||||
#define xmlXPathStackIsExternal(ctxt) \
|
|
||||||
((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xmlXPathEmptyNodeSet:
|
|
||||||
* @ns: a node-set
|
|
||||||
*
|
|
||||||
* Empties a node-set.
|
|
||||||
*/
|
|
||||||
#define xmlXPathEmptyNodeSet(ns) \
|
|
||||||
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CHECK_ERROR:
|
|
||||||
*
|
|
||||||
* Macro to return from the function if an XPath error was detected.
|
|
||||||
*/
|
|
||||||
#define CHECK_ERROR \
|
|
||||||
if (ctxt->error != XPATH_EXPRESSION_OK) return
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CHECK_ERROR0:
|
|
||||||
*
|
|
||||||
* Macro to return 0 from the function if an XPath error was detected.
|
|
||||||
*/
|
|
||||||
#define CHECK_ERROR0 \
|
|
||||||
if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* XP_ERROR:
|
|
||||||
* @X: the error code
|
|
||||||
*
|
|
||||||
* Macro to raise an XPath error and return.
|
|
||||||
*/
|
|
||||||
#define XP_ERROR(X) \
|
|
||||||
{ xmlXPathErr(ctxt, X); return; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* XP_ERROR0:
|
|
||||||
* @X: the error code
|
|
||||||
*
|
|
||||||
* Macro to raise an XPath error and return 0.
|
|
||||||
*/
|
|
||||||
#define XP_ERROR0(X) \
|
|
||||||
{ xmlXPathErr(ctxt, X); return(0); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CHECK_TYPE:
|
|
||||||
* @typeval: the XPath type
|
|
||||||
*
|
|
||||||
* Macro to check that the value on top of the XPath stack is of a given
|
|
||||||
* type.
|
|
||||||
*/
|
|
||||||
#define CHECK_TYPE(typeval) \
|
|
||||||
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
|
|
||||||
XP_ERROR(XPATH_INVALID_TYPE)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CHECK_TYPE0:
|
|
||||||
* @typeval: the XPath type
|
|
||||||
*
|
|
||||||
* Macro to check that the value on top of the XPath stack is of a given
|
|
||||||
* type. Return(0) in case of failure
|
|
||||||
*/
|
|
||||||
#define CHECK_TYPE0(typeval) \
|
|
||||||
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
|
|
||||||
XP_ERROR0(XPATH_INVALID_TYPE)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CHECK_ARITY:
|
|
||||||
* @x: the number of expected args
|
|
||||||
*
|
|
||||||
* Macro to check that the number of args passed to an XPath function matches.
|
|
||||||
*/
|
|
||||||
#define CHECK_ARITY(x) \
|
|
||||||
if (ctxt == NULL) return; \
|
|
||||||
if (nargs != (x)) \
|
|
||||||
XP_ERROR(XPATH_INVALID_ARITY);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CAST_TO_STRING:
|
|
||||||
*
|
|
||||||
* Macro to try to cast the value on the top of the XPath stack to a string.
|
|
||||||
*/
|
|
||||||
#define CAST_TO_STRING \
|
|
||||||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
|
|
||||||
xmlXPathStringFunction(ctxt, 1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CAST_TO_NUMBER:
|
|
||||||
*
|
|
||||||
* Macro to try to cast the value on the top of the XPath stack to a number.
|
|
||||||
*/
|
|
||||||
#define CAST_TO_NUMBER \
|
|
||||||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
|
|
||||||
xmlXPathNumberFunction(ctxt, 1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CAST_TO_BOOLEAN:
|
|
||||||
*
|
|
||||||
* Macro to try to cast the value on the top of the XPath stack to a boolean.
|
|
||||||
*/
|
|
||||||
#define CAST_TO_BOOLEAN \
|
|
||||||
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
|
|
||||||
xmlXPathBooleanFunction(ctxt, 1);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Variable Lookup forwarding.
|
|
||||||
*/
|
|
||||||
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
|
|
||||||
xmlXPathVariableLookupFunc f,
|
|
||||||
void *data);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Function Lookup forwarding.
|
|
||||||
*/
|
|
||||||
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
|
|
||||||
xmlXPathFuncLookupFunc f,
|
|
||||||
void *funcCtxt);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Error reporting.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPatherror (xmlXPathParserContextPtr ctxt,
|
|
||||||
const char *file,
|
|
||||||
int line,
|
|
||||||
int no);
|
|
||||||
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathErr (xmlXPathParserContextPtr ctxt,
|
|
||||||
int error);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NodeSet handling.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathNodeSetContains (xmlNodeSetPtr cur,
|
|
||||||
xmlNodePtr val);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathDifference (xmlNodeSetPtr nodes1,
|
|
||||||
xmlNodeSetPtr nodes2);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathIntersection (xmlNodeSetPtr nodes1,
|
|
||||||
xmlNodeSetPtr nodes2);
|
|
||||||
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathDistinct (xmlNodeSetPtr nodes);
|
|
||||||
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
|
|
||||||
xmlNodeSetPtr nodes2);
|
|
||||||
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
|
|
||||||
xmlNodePtr node);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
|
|
||||||
xmlNodeSetPtr nodes2);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathNodeLeading (xmlNodeSetPtr nodes,
|
|
||||||
xmlNodePtr node);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathLeading (xmlNodeSetPtr nodes1,
|
|
||||||
xmlNodeSetPtr nodes2);
|
|
||||||
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
|
|
||||||
xmlNodePtr node);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
|
|
||||||
xmlNodeSetPtr nodes2);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
|
|
||||||
xmlNodePtr node);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathTrailing (xmlNodeSetPtr nodes1,
|
|
||||||
xmlNodeSetPtr nodes2);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extending a context.
|
|
||||||
*/
|
|
||||||
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *prefix,
|
|
||||||
const xmlChar *ns_uri);
|
|
||||||
XMLPUBFUN const xmlChar * XMLCALL
|
|
||||||
xmlXPathNsLookup (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *prefix);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
|
|
||||||
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *name,
|
|
||||||
xmlXPathFunction f);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *name,
|
|
||||||
const xmlChar *ns_uri,
|
|
||||||
xmlXPathFunction f);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *name,
|
|
||||||
xmlXPathObjectPtr value);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *name,
|
|
||||||
const xmlChar *ns_uri,
|
|
||||||
xmlXPathObjectPtr value);
|
|
||||||
XMLPUBFUN xmlXPathFunction XMLCALL
|
|
||||||
xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *name);
|
|
||||||
XMLPUBFUN xmlXPathFunction XMLCALL
|
|
||||||
xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *name,
|
|
||||||
const xmlChar *ns_uri);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *name);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
|
|
||||||
const xmlChar *name,
|
|
||||||
const xmlChar *ns_uri);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utilities to extend XPath.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN xmlXPathParserContextPtr XMLCALL
|
|
||||||
xmlXPathNewParserContext (const xmlChar *str,
|
|
||||||
xmlXPathContextPtr ctxt);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
|
|
||||||
|
|
||||||
/* TODO: remap to xmlXPathValuePop and Push. */
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
valuePop (xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
valuePush (xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlXPathObjectPtr value);
|
|
||||||
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathNewString (const xmlChar *val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathNewCString (const char *val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathWrapString (xmlChar *val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathWrapCString (char * val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathNewFloat (double val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathNewBoolean (int val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathNewNodeSet (xmlNodePtr val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathNewValueTree (xmlNodePtr val);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
|
|
||||||
xmlNodePtr val);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
|
|
||||||
xmlNodePtr val);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
|
|
||||||
xmlNodePtr node,
|
|
||||||
xmlNsPtr ns);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathNodeSetSort (xmlNodeSetPtr set);
|
|
||||||
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathRoot (xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlXPathParseName (xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Existing functions.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN double XMLCALL
|
|
||||||
xmlXPathStringEvalNumber (const xmlChar *str);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlXPathObjectPtr res);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt);
|
|
||||||
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
|
||||||
xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
|
|
||||||
xmlNodeSetPtr val2);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathNodeSetDel (xmlNodeSetPtr cur,
|
|
||||||
xmlNodePtr val);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
|
|
||||||
int val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathNewNodeSetList (xmlNodeSetPtr val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathWrapNodeSet (xmlNodeSetPtr val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPathWrapExternal (void *val);
|
|
||||||
|
|
||||||
XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt);
|
|
||||||
|
|
||||||
XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Some of the axis navigation routines.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
|
|
||||||
xmlNodePtr cur);
|
|
||||||
/*
|
|
||||||
* The official core of XPath functions.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Really internal functions
|
|
||||||
*/
|
|
||||||
XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* LIBXML_XPATH_ENABLED */
|
|
||||||
#endif /* ! __XML_XPATH_INTERNALS_H__ */
|
#endif /* ! __XML_XPATH_INTERNALS_H__ */
|
||||||
|
@ -19,96 +19,4 @@
|
|||||||
|
|
||||||
#include <libxml/xmlversion.h>
|
#include <libxml/xmlversion.h>
|
||||||
|
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
|
|
||||||
#include <libxml/tree.h>
|
|
||||||
#include <libxml/xpath.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A Location Set
|
|
||||||
*/
|
|
||||||
typedef struct _xmlLocationSet xmlLocationSet;
|
|
||||||
typedef xmlLocationSet *xmlLocationSetPtr;
|
|
||||||
struct _xmlLocationSet {
|
|
||||||
int locNr; /* number of locations in the set */
|
|
||||||
int locMax; /* size of the array as allocated */
|
|
||||||
xmlXPathObjectPtr *locTab;/* array of locations */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Handling of location sets.
|
|
||||||
*/
|
|
||||||
|
|
||||||
XMLPUBFUN xmlLocationSetPtr XMLCALL
|
|
||||||
xmlXPtrLocationSetCreate (xmlXPathObjectPtr val);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
|
|
||||||
XMLPUBFUN xmlLocationSetPtr XMLCALL
|
|
||||||
xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
|
|
||||||
xmlLocationSetPtr val2);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewRange (xmlNodePtr start,
|
|
||||||
int startindex,
|
|
||||||
xmlNodePtr end,
|
|
||||||
int endindex);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
|
|
||||||
xmlXPathObjectPtr end);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewRangeNodePoint (xmlNodePtr start,
|
|
||||||
xmlXPathObjectPtr end);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
|
|
||||||
xmlNodePtr end);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewRangeNodes (xmlNodePtr start,
|
|
||||||
xmlNodePtr end);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewLocationSetNodes (xmlNodePtr start,
|
|
||||||
xmlNodePtr end);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewRangeNodeObject (xmlNodePtr start,
|
|
||||||
xmlXPathObjectPtr end);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrNewCollapsedRange (xmlNodePtr start);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
|
|
||||||
xmlXPathObjectPtr val);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
|
|
||||||
xmlXPathObjectPtr val);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
|
|
||||||
int val);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Functions.
|
|
||||||
*/
|
|
||||||
XMLPUBFUN xmlXPathContextPtr XMLCALL
|
|
||||||
xmlXPtrNewContext (xmlDocPtr doc,
|
|
||||||
xmlNodePtr here,
|
|
||||||
xmlNodePtr origin);
|
|
||||||
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
|
||||||
xmlXPtrEval (const xmlChar *str,
|
|
||||||
xmlXPathContextPtr ctx);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
|
|
||||||
int nargs);
|
|
||||||
XMLPUBFUN xmlNodePtr XMLCALL
|
|
||||||
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* LIBXML_XPTR_ENABLED */
|
|
||||||
#endif /* __XML_XPTR_H__ */
|
#endif /* __XML_XPTR_H__ */
|
||||||
|
@ -840,17 +840,9 @@ xmlHasFeature(xmlFeature feature)
|
|||||||
case XML_WITH_CATALOG:
|
case XML_WITH_CATALOG:
|
||||||
return(0);
|
return(0);
|
||||||
case XML_WITH_XPATH:
|
case XML_WITH_XPATH:
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
return(1);
|
|
||||||
#else
|
|
||||||
return(0);
|
return(0);
|
||||||
#endif
|
|
||||||
case XML_WITH_XPTR:
|
case XML_WITH_XPTR:
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
return(1);
|
|
||||||
#else
|
|
||||||
return(0);
|
return(0);
|
||||||
#endif
|
|
||||||
case XML_WITH_XINCLUDE:
|
case XML_WITH_XINCLUDE:
|
||||||
#ifdef LIBXML_XINCLUDE_ENABLED
|
#ifdef LIBXML_XINCLUDE_ENABLED
|
||||||
return(1);
|
return(1);
|
||||||
@ -14014,10 +14006,6 @@ xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func)
|
|||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
#include <libxml/xpath.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void XMLCDECL xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...);
|
extern void XMLCDECL xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...);
|
||||||
static int xmlParserInitialized = 0;
|
static int xmlParserInitialized = 0;
|
||||||
|
|
||||||
@ -14050,9 +14038,6 @@ xmlInitParser(void) {
|
|||||||
#ifdef LIBXML_OUTPUT_ENABLED
|
#ifdef LIBXML_OUTPUT_ENABLED
|
||||||
xmlRegisterDefaultOutputCallbacks();
|
xmlRegisterDefaultOutputCallbacks();
|
||||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
xmlXPathInit();
|
|
||||||
#endif
|
|
||||||
xmlParserInitialized = 1;
|
xmlParserInitialized = 1;
|
||||||
#ifdef LIBXML_THREAD_ENABLED
|
#ifdef LIBXML_THREAD_ENABLED
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ xmlSplitQName3(const xmlChar *name, int *len) {
|
|||||||
|
|
||||||
#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
|
#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
|
||||||
|
|
||||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
||||||
/**
|
/**
|
||||||
* xmlValidateNCName:
|
* xmlValidateNCName:
|
||||||
* @value: the value to check
|
* @value: the value to check
|
||||||
@ -5693,7 +5693,7 @@ xmlTextMerge(xmlNodePtr first, xmlNodePtr second) {
|
|||||||
return(first);
|
return(first);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||||
/**
|
/**
|
||||||
* xmlGetNsList:
|
* xmlGetNsList:
|
||||||
* @doc: the document
|
* @doc: the document
|
||||||
|
@ -1217,10 +1217,6 @@ xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
case XPATH_RANGE:
|
|
||||||
return(xmlXIncludeCopyRange(ctxt, target, source, obj));
|
|
||||||
#endif
|
|
||||||
case XPATH_POINT:
|
case XPATH_POINT:
|
||||||
/* points are ignored in XInclude */
|
/* points are ignored in XInclude */
|
||||||
break;
|
break;
|
||||||
@ -1395,9 +1391,6 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
|
|||||||
xmlChar *URL;
|
xmlChar *URL;
|
||||||
xmlChar *fragment = NULL;
|
xmlChar *fragment = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
int saveFlags;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_XINCLUDE
|
#ifdef DEBUG_XINCLUDE
|
||||||
xmlGenericError(xmlGenericErrorContext, "Loading doc %s:%d\n", url, nr);
|
xmlGenericError(xmlGenericErrorContext, "Loading doc %s:%d\n", url, nr);
|
||||||
@ -1467,22 +1460,8 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
|
|||||||
#ifdef DEBUG_XINCLUDE
|
#ifdef DEBUG_XINCLUDE
|
||||||
printf("loading %s\n", URL);
|
printf("loading %s\n", URL);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
/*
|
|
||||||
* If this is an XPointer evaluation, we want to assure that
|
|
||||||
* all entities have been resolved prior to processing the
|
|
||||||
* referenced document
|
|
||||||
*/
|
|
||||||
saveFlags = ctxt->parseFlags;
|
|
||||||
if (fragment != NULL) { /* if this is an XPointer eval */
|
|
||||||
ctxt->parseFlags |= XML_PARSE_NOENT;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
doc = xmlXIncludeParseFile(ctxt, (const char *)URL);
|
doc = xmlXIncludeParseFile(ctxt, (const char *)URL);
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
ctxt->parseFlags = saveFlags;
|
|
||||||
#endif
|
|
||||||
if (doc == NULL) {
|
if (doc == NULL) {
|
||||||
xmlFree(URL);
|
xmlFree(URL);
|
||||||
if (fragment != NULL)
|
if (fragment != NULL)
|
||||||
@ -1545,132 +1524,6 @@ loaded:
|
|||||||
doc, doc->children);
|
doc, doc->children);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
else {
|
|
||||||
/*
|
|
||||||
* Computes the XPointer expression and make a copy used
|
|
||||||
* as the replacement copy.
|
|
||||||
*/
|
|
||||||
xmlXPathObjectPtr xptr;
|
|
||||||
xmlXPathContextPtr xptrctxt;
|
|
||||||
xmlNodeSetPtr set;
|
|
||||||
|
|
||||||
if (doc == NULL) {
|
|
||||||
xptrctxt = xmlXPtrNewContext(ctxt->doc, ctxt->incTab[nr]->ref,
|
|
||||||
NULL);
|
|
||||||
} else {
|
|
||||||
xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
|
|
||||||
}
|
|
||||||
if (xptrctxt == NULL) {
|
|
||||||
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
|
|
||||||
XML_XINCLUDE_XPTR_FAILED,
|
|
||||||
"could not create XPointer context\n", NULL);
|
|
||||||
xmlFree(URL);
|
|
||||||
xmlFree(fragment);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
xptr = xmlXPtrEval(fragment, xptrctxt);
|
|
||||||
if (xptr == NULL) {
|
|
||||||
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
|
|
||||||
XML_XINCLUDE_XPTR_FAILED,
|
|
||||||
"XPointer evaluation failed: #%s\n",
|
|
||||||
fragment);
|
|
||||||
xmlXPathFreeContext(xptrctxt);
|
|
||||||
xmlFree(URL);
|
|
||||||
xmlFree(fragment);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
switch (xptr->type) {
|
|
||||||
case XPATH_UNDEFINED:
|
|
||||||
case XPATH_BOOLEAN:
|
|
||||||
case XPATH_NUMBER:
|
|
||||||
case XPATH_STRING:
|
|
||||||
case XPATH_POINT:
|
|
||||||
case XPATH_USERS:
|
|
||||||
case XPATH_XSLT_TREE:
|
|
||||||
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
|
|
||||||
XML_XINCLUDE_XPTR_RESULT,
|
|
||||||
"XPointer is not a range: #%s\n",
|
|
||||||
fragment);
|
|
||||||
xmlXPathFreeContext(xptrctxt);
|
|
||||||
xmlFree(URL);
|
|
||||||
xmlFree(fragment);
|
|
||||||
return(-1);
|
|
||||||
case XPATH_NODESET:
|
|
||||||
if ((xptr->nodesetval == NULL) ||
|
|
||||||
(xptr->nodesetval->nodeNr <= 0)) {
|
|
||||||
xmlXPathFreeContext(xptrctxt);
|
|
||||||
xmlFree(URL);
|
|
||||||
xmlFree(fragment);
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
case XPATH_RANGE:
|
|
||||||
case XPATH_LOCATIONSET:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
set = xptr->nodesetval;
|
|
||||||
if (set != NULL) {
|
|
||||||
for (i = 0;i < set->nodeNr;i++) {
|
|
||||||
if (set->nodeTab[i] == NULL)
|
|
||||||
continue;
|
|
||||||
switch (set->nodeTab[i]->type) {
|
|
||||||
case XML_ELEMENT_NODE:
|
|
||||||
case XML_TEXT_NODE:
|
|
||||||
case XML_CDATA_SECTION_NODE:
|
|
||||||
case XML_ENTITY_REF_NODE:
|
|
||||||
case XML_ENTITY_NODE:
|
|
||||||
case XML_PI_NODE:
|
|
||||||
case XML_COMMENT_NODE:
|
|
||||||
case XML_DOCUMENT_NODE:
|
|
||||||
case XML_HTML_DOCUMENT_NODE:
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case XML_ATTRIBUTE_NODE:
|
|
||||||
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
|
|
||||||
XML_XINCLUDE_XPTR_RESULT,
|
|
||||||
"XPointer selects an attribute: #%s\n",
|
|
||||||
fragment);
|
|
||||||
set->nodeTab[i] = NULL;
|
|
||||||
continue;
|
|
||||||
case XML_NAMESPACE_DECL:
|
|
||||||
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
|
|
||||||
XML_XINCLUDE_XPTR_RESULT,
|
|
||||||
"XPointer selects a namespace: #%s\n",
|
|
||||||
fragment);
|
|
||||||
set->nodeTab[i] = NULL;
|
|
||||||
continue;
|
|
||||||
case XML_DOCUMENT_TYPE_NODE:
|
|
||||||
case XML_DOCUMENT_FRAG_NODE:
|
|
||||||
case XML_NOTATION_NODE:
|
|
||||||
case XML_DTD_NODE:
|
|
||||||
case XML_ELEMENT_DECL:
|
|
||||||
case XML_ATTRIBUTE_DECL:
|
|
||||||
case XML_ENTITY_DECL:
|
|
||||||
case XML_XINCLUDE_START:
|
|
||||||
case XML_XINCLUDE_END:
|
|
||||||
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
|
|
||||||
XML_XINCLUDE_XPTR_RESULT,
|
|
||||||
"XPointer selects unexpected nodes: #%s\n",
|
|
||||||
fragment);
|
|
||||||
set->nodeTab[i] = NULL;
|
|
||||||
set->nodeTab[i] = NULL;
|
|
||||||
continue; /* for */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (doc == NULL) {
|
|
||||||
ctxt->incTab[nr]->xptr = xptr;
|
|
||||||
ctxt->incTab[nr]->inc = NULL;
|
|
||||||
} else {
|
|
||||||
ctxt->incTab[nr]->inc =
|
|
||||||
xmlXIncludeCopyXPointer(ctxt, ctxt->doc, doc, xptr);
|
|
||||||
xmlXPathFreeObject(xptr);
|
|
||||||
}
|
|
||||||
xmlXPathFreeContext(xptrctxt);
|
|
||||||
xmlFree(fragment);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do the xml:base fixup if needed
|
* Do the xml:base fixup if needed
|
||||||
|
@ -1,183 +0,0 @@
|
|||||||
/*
|
|
||||||
* xlink.c : implementation of the hyperlinks detection module
|
|
||||||
* This version supports both XML XLinks and HTML simple links
|
|
||||||
*
|
|
||||||
* See Copyright for the status of this software.
|
|
||||||
*
|
|
||||||
* daniel@veillard.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define IN_LIBXML
|
|
||||||
#include "libxml.h"
|
|
||||||
|
|
||||||
#ifdef LIBXML_XPTR_ENABLED
|
|
||||||
#include <string.h> /* for memset() only */
|
|
||||||
#ifdef HAVE_CTYPE_H
|
|
||||||
#include <ctype.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_STAT_H
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_FCNTL_H
|
|
||||||
#include <fcntl.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ZLIB_H
|
|
||||||
#include <zlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <libxml/xmlmemory.h>
|
|
||||||
#include <libxml/tree.h>
|
|
||||||
#include <libxml/parser.h>
|
|
||||||
#include <libxml/valid.h>
|
|
||||||
#include <libxml/xlink.h>
|
|
||||||
#include <libxml/globals.h>
|
|
||||||
|
|
||||||
#define XLINK_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xlink/namespace/")
|
|
||||||
#define XHTML_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xhtml/")
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
* *
|
|
||||||
* Default setting and related functions *
|
|
||||||
* *
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
static xlinkHandlerPtr xlinkDefaultHandler = NULL;
|
|
||||||
static xlinkNodeDetectFunc xlinkDefaultDetect = NULL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkGetDefaultHandler:
|
|
||||||
*
|
|
||||||
* Get the default xlink handler.
|
|
||||||
*
|
|
||||||
* Returns the current xlinkHandlerPtr value.
|
|
||||||
*/
|
|
||||||
xlinkHandlerPtr
|
|
||||||
xlinkGetDefaultHandler(void) {
|
|
||||||
return(xlinkDefaultHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkSetDefaultHandler:
|
|
||||||
* @handler: the new value for the xlink handler block
|
|
||||||
*
|
|
||||||
* Set the default xlink handlers
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
xlinkSetDefaultHandler(xlinkHandlerPtr handler) {
|
|
||||||
xlinkDefaultHandler = handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkGetDefaultDetect:
|
|
||||||
*
|
|
||||||
* Get the default xlink detection routine
|
|
||||||
*
|
|
||||||
* Returns the current function or NULL;
|
|
||||||
*/
|
|
||||||
xlinkNodeDetectFunc
|
|
||||||
xlinkGetDefaultDetect (void) {
|
|
||||||
return(xlinkDefaultDetect);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkSetDefaultDetect:
|
|
||||||
* @func: pointer to the new detection routine.
|
|
||||||
*
|
|
||||||
* Set the default xlink detection routine
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
xlinkSetDefaultDetect (xlinkNodeDetectFunc func) {
|
|
||||||
xlinkDefaultDetect = func;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
* *
|
|
||||||
* The detection routines *
|
|
||||||
* *
|
|
||||||
****************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xlinkIsLink:
|
|
||||||
* @doc: the document containing the node
|
|
||||||
* @node: the node pointer itself
|
|
||||||
*
|
|
||||||
* Check whether the given node carries the attributes needed
|
|
||||||
* to be a link element (or is one of the linking elements issued
|
|
||||||
* from the (X)HTML DtDs).
|
|
||||||
* This routine don't try to do full checking of the link validity
|
|
||||||
* but tries to detect and return the appropriate link type.
|
|
||||||
*
|
|
||||||
* Returns the xlinkType of the node (XLINK_TYPE_NONE if there is no
|
|
||||||
* link detected.
|
|
||||||
*/
|
|
||||||
xlinkType
|
|
||||||
xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
|
|
||||||
xmlChar *type = NULL, *role = NULL;
|
|
||||||
xlinkType ret = XLINK_TYPE_NONE;
|
|
||||||
|
|
||||||
if (node == NULL) return(XLINK_TYPE_NONE);
|
|
||||||
if (doc == NULL) doc = node->doc;
|
|
||||||
if ((doc != NULL) && (doc->type == XML_HTML_DOCUMENT_NODE)) {
|
|
||||||
/*
|
|
||||||
* This is an HTML document.
|
|
||||||
*/
|
|
||||||
} else if ((node->ns != NULL) &&
|
|
||||||
(xmlStrEqual(node->ns->href, XHTML_NAMESPACE))) {
|
|
||||||
/*
|
|
||||||
* !!!! We really need an IS_XHTML_ELEMENT function from HTMLtree.h @@@
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* This is an XHTML element within an XML document
|
|
||||||
* Check whether it's one of the element able to carry links
|
|
||||||
* and in that case if it holds the attributes.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We don't prevent a-priori having XML Linking constructs on
|
|
||||||
* XHTML elements
|
|
||||||
*/
|
|
||||||
type = xmlGetNsProp(node, BAD_CAST"type", XLINK_NAMESPACE);
|
|
||||||
if (type != NULL) {
|
|
||||||
if (xmlStrEqual(type, BAD_CAST "simple")) {
|
|
||||||
ret = XLINK_TYPE_SIMPLE;
|
|
||||||
} if (xmlStrEqual(type, BAD_CAST "extended")) {
|
|
||||||
role = xmlGetNsProp(node, BAD_CAST "role", XLINK_NAMESPACE);
|
|
||||||
if (role != NULL) {
|
|
||||||
xmlNsPtr xlink;
|
|
||||||
xlink = xmlSearchNs(doc, node, XLINK_NAMESPACE);
|
|
||||||
if (xlink == NULL) {
|
|
||||||
/* Humm, fallback method */
|
|
||||||
if (xmlStrEqual(role, BAD_CAST"xlink:external-linkset"))
|
|
||||||
ret = XLINK_TYPE_EXTENDED_SET;
|
|
||||||
} else {
|
|
||||||
xmlChar buf[200];
|
|
||||||
snprintf((char *) buf, sizeof(buf), "%s:external-linkset",
|
|
||||||
(char *) xlink->prefix);
|
|
||||||
buf[sizeof(buf) - 1] = 0;
|
|
||||||
if (xmlStrEqual(role, buf))
|
|
||||||
ret = XLINK_TYPE_EXTENDED_SET;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
ret = XLINK_TYPE_EXTENDED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type != NULL) xmlFree(type);
|
|
||||||
if (role != NULL) xmlFree(role);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
#endif /* LIBXML_XPTR_ENABLED */
|
|
||||||
#define bottom_xlink
|
|
||||||
#include "elfgcchack.h"
|
|
@ -173,9 +173,6 @@ static int nbregister = 0;
|
|||||||
#ifdef LIBXML_SAX1_ENABLED
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
static int sax1 = 0;
|
static int sax1 = 0;
|
||||||
#endif /* LIBXML_SAX1_ENABLED */
|
#endif /* LIBXML_SAX1_ENABLED */
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
static const char *xpathquery = NULL;
|
|
||||||
#endif
|
|
||||||
static int options = XML_PARSE_COMPACT;
|
static int options = XML_PARSE_COMPACT;
|
||||||
static int sax = 0;
|
static int sax = 0;
|
||||||
static int oldxml10 = 0;
|
static int oldxml10 = 0;
|
||||||
@ -1843,100 +1840,6 @@ static void walkDoc(xmlDocPtr doc) {
|
|||||||
}
|
}
|
||||||
#endif /* LIBXML_READER_ENABLED */
|
#endif /* LIBXML_READER_ENABLED */
|
||||||
|
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
/************************************************************************
|
|
||||||
* *
|
|
||||||
* XPath Query *
|
|
||||||
* *
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
static void doXPathDump(xmlXPathObjectPtr cur) {
|
|
||||||
switch(cur->type) {
|
|
||||||
case XPATH_NODESET: {
|
|
||||||
int i;
|
|
||||||
xmlNodePtr node;
|
|
||||||
#ifdef LIBXML_OUTPUT_ENABLED
|
|
||||||
xmlSaveCtxtPtr ctxt;
|
|
||||||
|
|
||||||
if (cur->nodesetval->nodeNr <= 0) {
|
|
||||||
fprintf(stderr, "XPath set is empty\n");
|
|
||||||
progresult = XMLLINT_ERR_XPATH;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ctxt = xmlSaveToFd(1, NULL, 0);
|
|
||||||
if (ctxt == NULL) {
|
|
||||||
fprintf(stderr, "Out of memory for XPath\n");
|
|
||||||
progresult = XMLLINT_ERR_MEM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (i = 0;i < cur->nodesetval->nodeNr;i++) {
|
|
||||||
node = cur->nodesetval->nodeTab[i];
|
|
||||||
xmlSaveTree(ctxt, node);
|
|
||||||
}
|
|
||||||
xmlSaveClose(ctxt);
|
|
||||||
#else
|
|
||||||
printf("xpath returned %d nodes\n", cur->nodesetval->nodeNr);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XPATH_BOOLEAN:
|
|
||||||
if (cur->boolval) printf("true");
|
|
||||||
else printf("false");
|
|
||||||
break;
|
|
||||||
case XPATH_NUMBER:
|
|
||||||
switch (xmlXPathIsInf(cur->floatval)) {
|
|
||||||
case 1:
|
|
||||||
printf("Infinity");
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
printf("-Infinity");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (xmlXPathIsNaN(cur->floatval)) {
|
|
||||||
printf("NaN");
|
|
||||||
} else {
|
|
||||||
printf("%0g", cur->floatval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case XPATH_STRING:
|
|
||||||
printf("%s", (const char *) cur->stringval);
|
|
||||||
break;
|
|
||||||
case XPATH_UNDEFINED:
|
|
||||||
fprintf(stderr, "XPath Object is uninitialized\n");
|
|
||||||
progresult = XMLLINT_ERR_XPATH;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "XPath object of unexpected type\n");
|
|
||||||
progresult = XMLLINT_ERR_XPATH;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void doXPathQuery(xmlDocPtr doc, const char *query) {
|
|
||||||
xmlXPathContextPtr ctxt;
|
|
||||||
xmlXPathObjectPtr res;
|
|
||||||
|
|
||||||
ctxt = xmlXPathNewContext(doc);
|
|
||||||
if (ctxt == NULL) {
|
|
||||||
fprintf(stderr, "Out of memory for XPath\n");
|
|
||||||
progresult = XMLLINT_ERR_MEM;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ctxt->node = xmlDocGetRootElement(doc);
|
|
||||||
res = xmlXPathEval(BAD_CAST query, ctxt);
|
|
||||||
xmlXPathFreeContext(ctxt);
|
|
||||||
|
|
||||||
if (res == NULL) {
|
|
||||||
fprintf(stderr, "XPath evaluation failure\n");
|
|
||||||
progresult = XMLLINT_ERR_XPATH;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
doXPathDump(res);
|
|
||||||
xmlXPathFreeObject(res);
|
|
||||||
}
|
|
||||||
#endif /* LIBXML_XPATH_ENABLED */
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Tree Test processing *
|
* Tree Test processing *
|
||||||
@ -2149,12 +2052,6 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
if (xpathquery != NULL) {
|
|
||||||
doXPathQuery(doc, xpathquery);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LIBXML_TREE_ENABLED
|
#ifdef LIBXML_TREE_ENABLED
|
||||||
/*
|
/*
|
||||||
* test intermediate copy if needed.
|
* test intermediate copy if needed.
|
||||||
@ -2660,9 +2557,6 @@ static void usage(const char *name) {
|
|||||||
#endif
|
#endif
|
||||||
printf("\t--sax: do not build a tree but work just at the SAX level\n");
|
printf("\t--sax: do not build a tree but work just at the SAX level\n");
|
||||||
printf("\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n");
|
printf("\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n");
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
printf("\t--xpath expr: evaluate the XPath expression, inply --noout\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("\nLibxml project home page: http://xmlsoft.org/\n");
|
printf("\nLibxml project home page: http://xmlsoft.org/\n");
|
||||||
printf("To report bugs or get some help check: http://xmlsoft.org/bugs.html\n");
|
printf("To report bugs or get some help check: http://xmlsoft.org/bugs.html\n");
|
||||||
@ -2972,13 +2866,6 @@ main(int argc, char **argv) {
|
|||||||
(!strcmp(argv[i], "--path"))) {
|
(!strcmp(argv[i], "--path"))) {
|
||||||
i++;
|
i++;
|
||||||
parsePath(BAD_CAST argv[i]);
|
parsePath(BAD_CAST argv[i]);
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
} else if ((!strcmp(argv[i], "-xpath")) ||
|
|
||||||
(!strcmp(argv[i], "--xpath"))) {
|
|
||||||
i++;
|
|
||||||
noout++;
|
|
||||||
xpathquery = argv[i];
|
|
||||||
#endif
|
|
||||||
} else if ((!strcmp(argv[i], "-oldxml10")) ||
|
} else if ((!strcmp(argv[i], "-oldxml10")) ||
|
||||||
(!strcmp(argv[i], "--oldxml10"))) {
|
(!strcmp(argv[i], "--oldxml10"))) {
|
||||||
oldxml10++;
|
oldxml10++;
|
||||||
@ -3145,13 +3032,6 @@ main(int argc, char **argv) {
|
|||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
|
||||||
if ((!strcmp(argv[i], "-xpath")) ||
|
|
||||||
(!strcmp(argv[i], "--xpath"))) {
|
|
||||||
i++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if ((timing) && (repeat))
|
if ((timing) && (repeat))
|
||||||
startTimer();
|
startTimer();
|
||||||
/* Remember file names. "-" means stdin. <sven@zen.org> */
|
/* Remember file names. "-" means stdin. <sven@zen.org> */
|
||||||
|
@ -34,11 +34,9 @@
|
|||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
|
||||||
#ifndef LIBXML_XPATH_ENABLED
|
|
||||||
extern double xmlXPathNAN;
|
extern double xmlXPathNAN;
|
||||||
extern double xmlXPathPINF;
|
extern double xmlXPathPINF;
|
||||||
extern double xmlXPathNINF;
|
extern double xmlXPathNINF;
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TODO \
|
#define TODO \
|
||||||
xmlGenericError(xmlGenericErrorContext, \
|
xmlGenericError(xmlGenericErrorContext, \
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user