Compiles an XPath or XQuery expression into an executable form.
Parameter | Description |
---|---|
XML | The XML document context for the query (can be NULL if not needed). |
Query | A valid XPath or XQuery expression string. |
Result | Receives a pointer to an XPathNode object on success. |
Call the Compile function to convert a valid XPath or XQuery expression string into a compiled form that can be executed against an XML document. The resulting compiled expression can be reused multiple times for efficiency and must be freed using FreeResource when no longer needed. They are re-usable between different XML documents and are treated as read-only for thread-safety.
The XML parameter is not required for compilation, but can potentially enhance syntax checking when parsing the expression. An additional benefit is that error messages will be defined in the #ErrorMsg field of the XML object if parsing fails.
Okay | Operation successful. |
---|---|
NullArgs | Function call missing argument value(s) |
Evaluates a compiled XPath or XQuery expression against an XML document.
Parameter | Description |
---|---|
XML | The XML document to evaluate the query against. |
Query | The compiled XPath or XQuery expression. |
Result | Receives the result of the evaluation. |
Use Evaluate to run a previously compiled XPath or XQuery expression against an XML document. The result of the evaluation is returned in the Result parameter as !XPathValue, which can represent various types of data including node sets, strings, numbers, or booleans.
Okay | Operation successful. |
---|---|
NullArgs | Function call missing argument value(s) |
For node-based queries, evaluates a compiled expression and calls a function for each matching node.
Parameter | Description |
---|---|
XML | The XML document to evaluate the query against. |
Query | The compiled XPath or XQuery expression. |
Callback | Pointer to a callback function that will be called for each matching node. Can be NULL if searching for the first matching node. |
Use the Query function to scan an XML document for tags or attributes that match a compiled XPath or XQuery expression. For every matching node, a user-defined callback function is invoked, allowing custom processing of each result.
If no callback is provided, the search stops after the first match and the XML object's cursor markers will reflect the position of the node.
Note that valid function execution can return ERR:Search
if zero matches are found.
Okay | At least one matching node was found and processed. |
---|---|
Search | No matching node was found. |
NoData | The XML document contains no data to search. |
Syntax | The provided query expression has syntax errors. |
NullArgs | At least one required parameter was not provided. |
Name | Description |
---|---|
XPathNodeType::AXIS_SPECIFIER | |
XPathNodeType::BINARY_OP | |
XPathNodeType::CONDITIONAL | |
XPathNodeType::EXPRESSION | |
XPathNodeType::FILTER | |
XPathNodeType::FLWOR_EXPRESSION | |
XPathNodeType::FOR_BINDING | |
XPathNodeType::FOR_EXPRESSION | |
XPathNodeType::FUNCTION_CALL | |
XPathNodeType::LET_BINDING | |
XPathNodeType::LET_EXPRESSION | |
XPathNodeType::LITERAL | |
XPathNodeType::LOCATION_PATH | |
XPathNodeType::NAME_TEST | |
XPathNodeType::NODE_TEST | |
XPathNodeType::NODE_TYPE_TEST | |
XPathNodeType::NUMBER | |
XPathNodeType::PATH | |
XPathNodeType::PREDICATE | |
XPathNodeType::PROCESSING_INSTRUCTION_TEST | |
XPathNodeType::QUANTIFIED_BINDING | |
XPathNodeType::QUANTIFIED_EXPRESSION | |
XPathNodeType::ROOT | |
XPathNodeType::STEP | |
XPathNodeType::STRING | |
XPathNodeType::UNARY_OP | |
XPathNodeType::UNION | |
XPathNodeType::VARIABLE_REFERENCE | |
XPathNodeType::WILDCARD |
Field | Type | Description |
---|