| 9480 | } |
| 9481 | |
| 9482 | xpath_node_set xpath_query::evaluate_node_set(const xpath_node& n) const |
| 9483 | { |
| 9484 | if (!_impl) return xpath_node_set(); |
| 9485 | |
| 9486 | xpath_ast_node* root = static_cast<xpath_query_impl*>(_impl)->root; |
| 9487 | |
| 9488 | if (root->rettype() != xpath_type_node_set) |
| 9489 | { |
| 9490 | #ifdef PUGIXML_NO_EXCEPTIONS |
| 9491 | return xpath_node_set(); |
| 9492 | #else |
| 9493 | xpath_parse_result result; |
| 9494 | result.error = "Expression does not evaluate to node set"; |
| 9495 | |
| 9496 | throw xpath_exception(result); |
| 9497 | #endif |
| 9498 | } |
| 9499 | |
| 9500 | xpath_context c(n, 1, 1); |
| 9501 | xpath_stack_data sd; |
| 9502 | |
| 9503 | #ifdef PUGIXML_NO_EXCEPTIONS |
| 9504 | if (setjmp(sd.error_handler)) return xpath_node_set(); |
| 9505 | #endif |
| 9506 | |
| 9507 | xpath_node_set_raw r = root->eval_node_set(c, sd.stack); |
| 9508 | |
| 9509 | return xpath_node_set(r.begin(), r.end(), r.type()); |
| 9510 | } |
| 9511 | |
| 9512 | const xpath_parse_result& xpath_query::result() const |
| 9513 | { |
no test coverage detected