|
libxml2
|
XML Path Language implementation. More...
Data Structures | |
| struct | _xmlNodeSet |
| A node-set (an unordered collection of nodes without duplicates). More... | |
| struct | _xmlXPathObject |
| An XPath object. More... | |
| struct | _xmlXPathContext |
| Expression evaluation occurs with respect to a context. More... | |
| struct | _xmlXPathParserContext |
| An XPath parser context. More... | |
Macros | |
| #define | XML_XPATH_CHECKNS (1<<0) |
| Flags for XPath engine compilation and runtime. | |
| #define | XML_XPATH_NOVAR (1<<1) |
| forbid variables in expression | |
Typedefs | |
| typedef struct _xmlXPathContext | xmlXPathContext |
| XPath context. | |
| typedef struct _xmlXPathParserContext | xmlXPathParserContext |
| XPath parser and evaluation context. | |
| typedef struct _xmlNodeSet | xmlNodeSet |
| XPath node set. | |
| typedef struct _xmlXPathObject | xmlXPathObject |
| XPath object. | |
| typedef void(* | xmlXPathFunction) (xmlXPathParserContext *ctxt, int nargs) |
| An XPath function. | |
| typedef xmlXPathObject *(* | xmlXPathVariableLookupFunc) (void *ctxt, const xmlChar *name, const xmlChar *ns_uri) |
| Prototype for callbacks used to plug variable lookup in the XPath engine. | |
| typedef xmlXPathFunction(* | xmlXPathFuncLookupFunc) (void *ctxt, const xmlChar *name, const xmlChar *ns_uri) |
| Prototype for callbacks used to plug function lookup in the XPath engine. | |
| typedef struct _xmlXPathCompExpr | xmlXPathCompExpr |
| Compiled XPath expression. | |
Enumerations | |
| enum | xmlXPathError |
| The set of XPath error codes. | |
| enum | xmlXPathObjectType |
| An expression is evaluated to yield an object, which has one of the following four basic types: More... | |
Functions | |
| void | xmlXPathFreeObject (xmlXPathObject *obj) |
| Objects and Nodesets handling. | |
| xmlNodeSet * | xmlXPathNodeSetCreate (xmlNode *val) |
| Create a new xmlNodeSet of type double and of value val | |
| void | xmlXPathFreeNodeSetList (xmlXPathObject *obj) |
| Free up the xmlXPathObject obj but don't deallocate the objects in the list contrary to xmlXPathFreeObject. | |
| void | xmlXPathFreeNodeSet (xmlNodeSet *obj) |
| Free the NodeSet compound (not the actual nodes !). | |
| xmlXPathObject * | xmlXPathObjectCopy (xmlXPathObject *val) |
| allocate a new copy of a given object | |
| int | xmlXPathCmpNodes (xmlNode *node1, xmlNode *node2) |
| Compare two nodes w.r.t document order. | |
| int | xmlXPathCastNumberToBoolean (double val) |
| Conversion functions to basic types. | |
| int | xmlXPathCastStringToBoolean (const xmlChar *val) |
| Converts a string to its boolean value. | |
| int | xmlXPathCastNodeSetToBoolean (xmlNodeSet *ns) |
| Converts a node-set to its boolean value. | |
| int | xmlXPathCastToBoolean (xmlXPathObject *val) |
| Converts an XPath object to its boolean value. | |
| double | xmlXPathCastBooleanToNumber (int val) |
| Converts a boolean to its number value. | |
| double | xmlXPathCastStringToNumber (const xmlChar *val) |
| Converts a string to its number value. | |
| double | xmlXPathCastNodeToNumber (xmlNode *node) |
| Converts a node to its number value. | |
| double | xmlXPathCastNodeSetToNumber (xmlNodeSet *ns) |
| Converts a node-set to its number value. | |
| double | xmlXPathCastToNumber (xmlXPathObject *val) |
| Converts an XPath object to its number value. | |
| xmlChar * | xmlXPathCastBooleanToString (int val) |
| Converts a boolean to its string value. | |
| xmlChar * | xmlXPathCastNumberToString (double val) |
| Converts a number to its string value. | |
| xmlChar * | xmlXPathCastNodeToString (xmlNode *node) |
| Converts a node to its string value. | |
| xmlChar * | xmlXPathCastNodeSetToString (xmlNodeSet *ns) |
| Converts a node-set to its string value. | |
| xmlChar * | xmlXPathCastToString (xmlXPathObject *val) |
| Converts an existing object to its string() equivalent. | |
| xmlXPathObject * | xmlXPathConvertBoolean (xmlXPathObject *val) |
| Converts an existing object to its boolean() equivalent. | |
| xmlXPathObject * | xmlXPathConvertNumber (xmlXPathObject *val) |
| Converts an existing object to its number() equivalent. | |
| xmlXPathObject * | xmlXPathConvertString (xmlXPathObject *val) |
| Converts an existing object to its string() equivalent. | |
| xmlXPathContext * | xmlXPathNewContext (xmlDoc *doc) |
| Context handling. | |
| void | xmlXPathFreeContext (xmlXPathContext *ctxt) |
| Free up an xmlXPathContext. | |
| void | xmlXPathSetErrorHandler (xmlXPathContext *ctxt, xmlStructuredErrorFunc handler, void *context) |
| Register a callback function that will be called on errors and warnings. | |
| int | xmlXPathContextSetCache (xmlXPathContext *ctxt, int active, int value, int options) |
| Creates/frees an object cache on the XPath context. | |
| long | xmlXPathOrderDocElems (xmlDoc *doc) |
| Evaluation functions. | |
| int | xmlXPathSetContextNode (xmlNode *node, xmlXPathContext *ctx) |
| Sets 'node' as the context node. | |
| xmlXPathObject * | xmlXPathNodeEval (xmlNode *node, const xmlChar *str, xmlXPathContext *ctx) |
| Evaluate the XPath Location Path in the given context. | |
| xmlXPathObject * | xmlXPathEval (const xmlChar *str, xmlXPathContext *ctx) |
| Evaluate the XPath Location Path in the given context. | |
| xmlXPathObject * | xmlXPathEvalExpression (const xmlChar *str, xmlXPathContext *ctxt) |
| Alias for xmlXPathEval. | |
| int | xmlXPathEvalPredicate (xmlXPathContext *ctxt, xmlXPathObject *res) |
| Evaluate a predicate result for the current node. | |
| xmlXPathCompExpr * | xmlXPathCompile (const xmlChar *str) |
| Separate compilation/evaluation entry points. | |
| xmlXPathCompExpr * | xmlXPathCtxtCompile (xmlXPathContext *ctxt, const xmlChar *str) |
| Compile an XPath expression. | |
| xmlXPathObject * | xmlXPathCompiledEval (xmlXPathCompExpr *comp, xmlXPathContext *ctx) |
| Evaluate the Precompiled XPath expression in the given context. | |
| int | xmlXPathCompiledEvalToBoolean (xmlXPathCompExpr *comp, xmlXPathContext *ctxt) |
| Applies the XPath boolean() function on the result of the given compiled expression. | |
| void | xmlXPathFreeCompExpr (xmlXPathCompExpr *comp) |
| Free up the memory allocated by comp | |
| void | xmlXPathInit (void) |
| int | xmlXPathIsNaN (double val) |
| Checks whether a double is a NaN. | |
| int | xmlXPathIsInf (double val) |
| Checks whether a double is an infinity. | |
XML Path Language implementation.
API for the XML Path Language implementation
XML Path Language implementation XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer http://www.w3.org/TR/xpath
Implements W3C Recommendation 16 November 1999 http://www.w3.org/TR/1999/REC-xpath-19991116
| #define XML_XPATH_CHECKNS (1<<0) |
Flags for XPath engine compilation and runtime.
check namespaces at compilation
| typedef xmlXPathFunction(* xmlXPathFuncLookupFunc) (void *ctxt, const xmlChar *name, const xmlChar *ns_uri) |
Prototype for callbacks used to plug function lookup in the XPath engine.
| ctxt | an XPath context |
| name | name of the function |
| ns_uri | the namespace name hosting this function |
| typedef void(* xmlXPathFunction) (xmlXPathParserContext *ctxt, int nargs) |
An XPath function.
The arguments (if any) are popped out from the context stack and the result is pushed on the stack.
| ctxt | the XPath interprestation context |
| nargs | the number of arguments |
| typedef xmlXPathObject *(* xmlXPathVariableLookupFunc) (void *ctxt, const xmlChar *name, const xmlChar *ns_uri) |
Prototype for callbacks used to plug variable lookup in the XPath engine.
| ctxt | an XPath context |
| name | name of the variable |
| ns_uri | the namespace name hosting this variable |
| enum xmlXPathObjectType |
An expression is evaluated to yield an object, which has one of the following four basic types:
| double xmlXPathCastBooleanToNumber | ( | int | val | ) |
Converts a boolean to its number value.
| val | a boolean |
| xmlChar * xmlXPathCastBooleanToString | ( | int | val | ) |
Converts a boolean to its string value.
| val | a boolean |
| int xmlXPathCastNodeSetToBoolean | ( | xmlNodeSet * | ns | ) |
Converts a node-set to its boolean value.
| ns | a node-set |
| double xmlXPathCastNodeSetToNumber | ( | xmlNodeSet * | ns | ) |
Converts a node-set to its number value.
| ns | a node-set |
| xmlChar * xmlXPathCastNodeSetToString | ( | xmlNodeSet * | ns | ) |
Converts a node-set to its string value.
| ns | a node-set |
| double xmlXPathCastNodeToNumber | ( | xmlNode * | node | ) |
Converts a node to its number value.
| node | a node |
Converts a node to its string value.
| node | a node |
| int xmlXPathCastNumberToBoolean | ( | double | val | ) |
Conversion functions to basic types.
Conversion functions to basic types.
| val | a number |
| xmlChar * xmlXPathCastNumberToString | ( | double | val | ) |
Converts a number to its string value.
| val | a number |
| int xmlXPathCastStringToBoolean | ( | const xmlChar * | val | ) |
Converts a string to its boolean value.
| val | a string |
| double xmlXPathCastStringToNumber | ( | const xmlChar * | val | ) |
Converts a string to its number value.
| val | a string |
| int xmlXPathCastToBoolean | ( | xmlXPathObject * | val | ) |
Converts an XPath object to its boolean value.
| val | an XPath object |
| double xmlXPathCastToNumber | ( | xmlXPathObject * | val | ) |
Converts an XPath object to its number value.
| val | an XPath object |
| xmlChar * xmlXPathCastToString | ( | xmlXPathObject * | val | ) |
Converts an existing object to its string() equivalent.
| val | an XPath object |
Compare two nodes w.r.t document order.
| node1 | the first node |
| node2 | the second node |
| xmlXPathCompExpr * xmlXPathCompile | ( | const xmlChar * | str | ) |
Separate compilation/evaluation entry points.
Separate compilation/evaluation entry points.
| str | the XPath expression |
| xmlXPathObject * xmlXPathCompiledEval | ( | xmlXPathCompExpr * | comp, |
| xmlXPathContext * | ctx ) |
Evaluate the Precompiled XPath expression in the given context.
| comp | the compiled XPath expression |
| ctx | the XPath context |
| int xmlXPathCompiledEvalToBoolean | ( | xmlXPathCompExpr * | comp, |
| xmlXPathContext * | ctxt ) |
Applies the XPath boolean() function on the result of the given compiled expression.
| comp | the compiled XPath expression |
| ctxt | the XPath context |
| int xmlXPathContextSetCache | ( | xmlXPathContext * | ctxt, |
| int | active, | ||
| int | value, | ||
| int | options ) |
Creates/frees an object cache on the XPath context.
If activates XPath objects (xmlXPathObject) will be cached internally to be reused.
options must be set to 0 to enable XPath object caching. Other values for options have currently no effect.
value sets the maximum number of XPath objects to be cached per slot. There are two slots for node-set and misc objects. Use <0 for the default number (100).
| ctxt | the XPath context |
| active | enables/disables (creates/frees) the cache |
| value | a value with semantics dependent on options |
| options | options (currently only the value 0 is used) |
| xmlXPathObject * xmlXPathConvertBoolean | ( | xmlXPathObject * | val | ) |
Converts an existing object to its boolean() equivalent.
| val | an XPath object |
| xmlXPathObject * xmlXPathConvertNumber | ( | xmlXPathObject * | val | ) |
Converts an existing object to its number() equivalent.
| val | an XPath object |
| xmlXPathObject * xmlXPathConvertString | ( | xmlXPathObject * | val | ) |
Converts an existing object to its string() equivalent.
| val | an XPath object |
| xmlXPathCompExpr * xmlXPathCtxtCompile | ( | xmlXPathContext * | ctxt, |
| const xmlChar * | str ) |
Compile an XPath expression.
| ctxt | an XPath context |
| str | the XPath expression |
| xmlXPathObject * xmlXPathEval | ( | const xmlChar * | str, |
| xmlXPathContext * | ctx ) |
Evaluate the XPath Location Path in the given context.
| str | the XPath expression |
| ctx | the XPath context |
| xmlXPathObject * xmlXPathEvalExpression | ( | const xmlChar * | str, |
| xmlXPathContext * | ctxt ) |
Alias for xmlXPathEval.
| str | the XPath expression |
| ctxt | the XPath context |
| int xmlXPathEvalPredicate | ( | xmlXPathContext * | ctxt, |
| xmlXPathObject * | res ) |
Evaluate a predicate result for the current node.
A PredicateExpr is evaluated by evaluating the Expr and converting the result to a boolean. If the result is a number, the result will be converted to true if the number is equal to the position of the context node in the context node list (as returned by the position function) and will be converted to false otherwise; if the result is not a number, then the result will be converted as if by a call to the boolean function.
| ctxt | the XPath context |
| res | the Predicate Expression evaluation result |
| void xmlXPathFreeCompExpr | ( | xmlXPathCompExpr * | comp | ) |
Free up the memory allocated by comp
| comp | an XPATH comp |
| void xmlXPathFreeContext | ( | xmlXPathContext * | ctxt | ) |
Free up an xmlXPathContext.
| ctxt | the context to free |
| void xmlXPathFreeNodeSet | ( | xmlNodeSet * | obj | ) |
Free the NodeSet compound (not the actual nodes !).
| obj | the xmlNodeSet to free |
| void xmlXPathFreeNodeSetList | ( | xmlXPathObject * | obj | ) |
Free up the xmlXPathObject obj but don't deallocate the objects in the list contrary to xmlXPathFreeObject.
| obj | an existing NodeSetList object |
| void xmlXPathFreeObject | ( | xmlXPathObject * | obj | ) |
Objects and Nodesets handling.
Objects and Nodesets handling.
| obj | the object to free |
| void xmlXPathInit | ( | void | ) |
| int xmlXPathIsInf | ( | double | val | ) |
Checks whether a double is an infinity.
| val | a double value |
| int xmlXPathIsNaN | ( | double | val | ) |
Checks whether a double is a NaN.
| val | a double value |
| xmlXPathContext * xmlXPathNewContext | ( | xmlDoc * | doc | ) |
Context handling.
Context handling.
| doc | the XML document |
| xmlXPathObject * xmlXPathNodeEval | ( | xmlNode * | node, |
| const xmlChar * | str, | ||
| xmlXPathContext * | ctx ) |
Evaluate the XPath Location Path in the given context.
The node 'node' is set as the context node. The context node is not restored.
| node | the node to to use as the context node |
| str | the XPath expression |
| ctx | the XPath context |
| xmlNodeSet * xmlXPathNodeSetCreate | ( | xmlNode * | val | ) |
Create a new xmlNodeSet of type double and of value val
| val | an initial xmlNode, or NULL |
| xmlXPathObject * xmlXPathObjectCopy | ( | xmlXPathObject * | val | ) |
allocate a new copy of a given object
| val | the original object |
| long xmlXPathOrderDocElems | ( | xmlDoc * | doc | ) |
Evaluation functions.
Evaluation functions.
This stamps all the element nodes with the document order Like for line information, the order is kept in the element->content field, the value stored is actually - the node number (starting at -1) to be able to differentiate from line numbers.
| doc | an input document |
| int xmlXPathSetContextNode | ( | xmlNode * | node, |
| xmlXPathContext * | ctx ) |
Sets 'node' as the context node.
The node must be in the same document as that associated with the context.
| node | the node to to use as the context node |
| ctx | the XPath context |
| void xmlXPathSetErrorHandler | ( | xmlXPathContext * | ctxt, |
| xmlStructuredErrorFunc | handler, | ||
| void * | data ) |
Register a callback function that will be called on errors and warnings.
If handler is NULL, the error handler will be deactivated.
| ctxt | the XPath context |
| handler | error handler |
| data | user data which will be passed to the handler |