TiXI  3.3.0
XPath Utility Functions

Functions

DLL_EXPORT ReturnCode tixiXPathEvaluateNodeNumber (TixiDocumentHandle handle, const char *xPathExpression, int *number)
 Evaluates a XPath expression and returns the number of result nodes matching this xpath expression. More...
 
DLL_EXPORT ReturnCode tixiXPathExpressionGetXPath (TixiDocumentHandle handle, const char *xPathExpression, int index, char **xPath)
 Evaluates a XPath expression and the xPath for the i-th result. More...
 
DLL_EXPORT ReturnCode tixiXPathExpressionGetTextByIndex (TixiDocumentHandle handle, const char *xPathExpression, int elementNumber, char **text)
 Evaluates a XPath expression and returns the text content of the resultnode matching this xpath expression. More...
 

Detailed Description

Function for evaluating XPath expressions.

Function Documentation

DLL_EXPORT ReturnCode tixiXPathEvaluateNodeNumber ( TixiDocumentHandle  handle,
const char *  xPathExpression,
int *  number 
)

Evaluates a XPath expression and returns the number of result nodes matching this xpath expression.

Fortran syntax:

tixi_xpath_evaluate_node_number( integer handle, character*n xpathExpression, integer number, integer error )

Parameters
[in]handlehandle as returned by tixiOpenDocument, tixiOpenDocumentRecursive, tixiOpenDocumentFromHTTP, tixiCreateDocument or tixiImportFromString
[in]xPathExpressionThe XPath Expression to evaluate.
[out]numberThe number of nodes matching this xpath expression.
Returns
  • SUCCESS if successfully retrieved the number of the xPath search.
  • FAILED if an internal error occured.
DLL_EXPORT ReturnCode tixiXPathExpressionGetTextByIndex ( TixiDocumentHandle  handle,
const char *  xPathExpression,
int  elementNumber,
char **  text 
)

Evaluates a XPath expression and returns the text content of the resultnode matching this xpath expression.

The element to get is selected by an index number, which should be between 1 and 'tixiXPathEvaluateNodeNumber() (inclusively)'. On successful return the memory used for text is allocated internally and must not be released by the user. The deallocation is handle when the document referred to by handle is closed.

Fortran syntax:

tixi_xpath_expression_get_text_by_index( integer handle, character*n xpathERxpression, integer index, character*n text, integer error )

Parameters
[in]handlehandle as returned by tixiOpenDocument, tixiOpenDocumentRecursive, tixiOpenDocumentFromHTTP, tixiCreateDocument or tixiImportFromString
[in]xPathExpressionThe XPath Expression to evaluate.
[in]elementNumberThe (index)-number to get. Needed if the XPath expression catches more than one node. Index must be between 1 and 'tixiXPathEvaluateNodeNumber()', inclusively.
[out]textthe text content of the node-value. Works for xml-elements and attributes. NULL if an error occured.
Returns
  • SUCCESS if successfully retrieve the text content of a single element.
  • INVALID_XPATH If something goes wrong on evaluating the xpath expression.
  • FAILED is an internal error occured.
DLL_EXPORT ReturnCode tixiXPathExpressionGetXPath ( TixiDocumentHandle  handle,
const char *  xPathExpression,
int  index,
char **  xPath 
)

Evaluates a XPath expression and the xPath for the i-th result.

Parameters
[in]handlehandle as returned by tixiOpenDocument, tixiOpenDocumentRecursive, tixiOpenDocumentFromHTTP, tixiCreateDocument or tixiImportFromString
[in]xPathExpressionThe XPath Expression to evaluate.
[in]indexThe index of the result to query, with 1 <= index <= number, and number queried with tixiXPathEvaluateNodeNumber
[out]xPathThe xPath of the search result.
Returns
  • SUCCESS if successfully retrieve the xPath of the search.
  • INVALID_HANDLE if the handle is not valid, i.e. does not or no longer exist.
  • FAILED if an internal error occured.

Generated Tue Mar 8 2022 14:11:54, by Martin Siggel DLR