| 10121 | } |
| 10122 | |
| 10123 | PUGI__FN xpath_node_set xpath_query::evaluate_node_set(const xpath_node& n) const |
| 10124 | { |
| 10125 | if (!_impl) return xpath_node_set(); |
| 10126 | |
| 10127 | impl::xpath_ast_node* root = static_cast<impl::xpath_query_impl*>(_impl)->root; |
| 10128 | |
| 10129 | if (root->rettype() != xpath_type_node_set) |
| 10130 | { |
| 10131 | #ifdef PUGIXML_NO_EXCEPTIONS |
| 10132 | return xpath_node_set(); |
| 10133 | #else |
| 10134 | xpath_parse_result res; |
| 10135 | res.error = "Expression does not evaluate to node set"; |
| 10136 | |
| 10137 | throw xpath_exception(res); |
| 10138 | #endif |
| 10139 | } |
| 10140 | |
| 10141 | impl::xpath_context c(n, 1, 1); |
| 10142 | impl::xpath_stack_data sd; |
| 10143 | |
| 10144 | #ifdef PUGIXML_NO_EXCEPTIONS |
| 10145 | if (setjmp(sd.error_handler)) return xpath_node_set(); |
| 10146 | #endif |
| 10147 | |
| 10148 | impl::xpath_node_set_raw r = root->eval_node_set(c, sd.stack); |
| 10149 | |
| 10150 | return xpath_node_set(r.begin(), r.end(), r.type()); |
| 10151 | } |
| 10152 | |
| 10153 | PUGI__FN const xpath_parse_result& xpath_query::result() const |
| 10154 | { |
no test coverage detected