| 10978 | } |
| 10979 | |
| 10980 | PUGI__FN xpath_node_set xpath_query::evaluate_node_set(const xpath_node& n) const |
| 10981 | { |
| 10982 | if (!_impl) |
| 10983 | return xpath_node_set(); |
| 10984 | |
| 10985 | impl::xpath_ast_node* root = static_cast<impl::xpath_query_impl*>(_impl)->root; |
| 10986 | |
| 10987 | if (root->rettype() != xpath_type_node_set) |
| 10988 | { |
| 10989 | #ifdef PUGIXML_NO_EXCEPTIONS |
| 10990 | return xpath_node_set(); |
| 10991 | #else |
| 10992 | xpath_parse_result res; |
| 10993 | res.error = "Expression does not evaluate to node set"; |
| 10994 | |
| 10995 | throw xpath_exception(res); |
| 10996 | #endif |
| 10997 | } |
| 10998 | |
| 10999 | impl::xpath_context c(n, 1, 1); |
| 11000 | impl::xpath_stack_data sd; |
| 11001 | |
| 11002 | #ifdef PUGIXML_NO_EXCEPTIONS |
| 11003 | if (setjmp(sd.error_handler)) |
| 11004 | return xpath_node_set(); |
| 11005 | #endif |
| 11006 | |
| 11007 | impl::xpath_node_set_raw r = root->eval_node_set(c, sd.stack); |
| 11008 | |
| 11009 | return xpath_node_set(r.begin(), r.end(), r.type()); |
| 11010 | } |
| 11011 | |
| 11012 | PUGI__FN const xpath_parse_result& xpath_query::result() const |
| 11013 | { |
no test coverage detected