Invoking the stand-alone XPath evaluator PreviousNext

All the following is out-of-date, almost certainly wrong, and not supported.

To evaluate an XPath expression in a stand-alone environment (or equivalently, from a host language of your own devising), follow the following steps:

Creating an evaluator

Call creation procedure make (digits, on_or_off) from class XM_XPATH_EVALUATOR. Digits is the precision for decimal arithmetic. It should be at least 18 (or 0, for infinite precision). On_or_off indicates wheter or not line numbering should be turned on for error messages.

XM_XPATH_EVALUATOR inherits from XM_STRING_MODE, so you should then call one of the string-mode setting procedures from that class on the evaluator. It will in turn call the same procedure on the Eiffel XML parser.

Building a static context

Before calling evaluate, it is first necessary to create a static context. Two features are provided to do this:

Performing the evaluation

The sole argument to evaluate (an_expression_text: STRING) is the text of the XPath expression which you wish to evaluate.

Checking for evaluation errors

After calling evaluate, check is_error to see if an error occurred. if it did, then feature error_value contains the details of the error. See XM_XPATH_ERROR_VALUE.

Retrieving the results of an evaluation

If the evaluation was successful, evaluated_items: DS_LINKED_LIST [XM_XPATH_ITEM] contains a list of results. These are all of type XM_XPATH_ITEM, representing an XPath item. An item may either be a node (XM_XPATH_NODE), or an atomic value (XM_XPATH_ATOMIC_VALUE).


Copyright 2004-2016, Colin Adams and others
mailto:colin@colina.demon.co.uk
http://www.gobosoft.com
Last Updated: 27 December 2016
HomeTocPreviousNext