pugi::xpath_query Class Reference

Collaboration diagram for pugi::xpath_query:

Collaboration graph
[legend]
List of all members.

Detailed Description

A class that holds compiled XPath query and allows to evaluate query result.


Public Member Functions

 xpath_query (const char *query)
 Ctor from string with XPath expression.
 ~xpath_query ()
 Dtor.
xpath_type_t return_type () const
 Get query expression return type.
bool evaluate_boolean (const xml_node &n) const
 Evaluate expression as boolean value for the context node n.
double evaluate_number (const xml_node &n) const
 Evaluate expression as double value for the context node n.
std::string evaluate_string (const xml_node &n) const
 Evaluate expression as string value for the context node n.
xpath_node_set evaluate_node_set (const xml_node &n) const
 Evaluate expression as node set for the context node n.


Constructor & Destructor Documentation

pugi::xpath_query::xpath_query const char *  query  )  [explicit]
 

Ctor from string with XPath expression.

Throws xpath_exception on compilation error, std::bad_alloc on out of memory error.

Parameters:
query - string with XPath expression


Member Function Documentation

xpath_type_t pugi::xpath_query::return_type  )  const
 

Get query expression return type.

Returns:
expression return type

bool pugi::xpath_query::evaluate_boolean const xml_node n  )  const
 

Evaluate expression as boolean value for the context node n.

If expression does not directly evaluate to boolean, the expression result is converted as through boolean() XPath function call. Throws std::bad_alloc on out of memory error.

Parameters:
n - context node
Returns:
evaluation result

double pugi::xpath_query::evaluate_number const xml_node n  )  const
 

Evaluate expression as double value for the context node n.

If expression does not directly evaluate to double, the expression result is converted as through number() XPath function call. Throws std::bad_alloc on out of memory error.

Parameters:
n - context node
Returns:
evaluation result

std::string pugi::xpath_query::evaluate_string const xml_node n  )  const
 

Evaluate expression as string value for the context node n.

If expression does not directly evaluate to string, the expression result is converted as through string() XPath function call. Throws std::bad_alloc on out of memory error.

Parameters:
n - context node
Returns:
evaluation result

xpath_node_set pugi::xpath_query::evaluate_node_set const xml_node n  )  const
 

Evaluate expression as node set for the context node n.

If expression does not directly evaluate to node set, throws xpath_exception. Throws std::bad_alloc on out of memory error.

Parameters:
n - context node
Returns:
evaluation result


Generated on Tue Jan 5 20:02:10 2010 for pugixml by  doxygen 1.4.6-NO