| 5410 | } |
| 5411 | |
| 5412 | xpath_string string_value(const xpath_node& na, xpath_allocator* alloc) |
| 5413 | { |
| 5414 | if (na.attribute()) |
| 5415 | return xpath_string_const(na.attribute().value()); |
| 5416 | else |
| 5417 | { |
| 5418 | const xml_node& n = na.node(); |
| 5419 | |
| 5420 | switch (n.type()) |
| 5421 | { |
| 5422 | case node_pcdata: |
| 5423 | case node_cdata: |
| 5424 | case node_comment: |
| 5425 | case node_pi: |
| 5426 | return xpath_string_const(n.value()); |
| 5427 | |
| 5428 | case node_document: |
| 5429 | case node_element: |
| 5430 | { |
| 5431 | xpath_string result; |
| 5432 | |
| 5433 | xml_node cur = n.first_child(); |
| 5434 | |
| 5435 | while (cur && cur != n) |
| 5436 | { |
| 5437 | if (cur.type() == node_pcdata || cur.type() == node_cdata) |
| 5438 | result.append(xpath_string_const(cur.value()), alloc); |
| 5439 | |
| 5440 | if (cur.first_child()) |
| 5441 | cur = cur.first_child(); |
| 5442 | else if (cur.next_sibling()) |
| 5443 | cur = cur.next_sibling(); |
| 5444 | else |
| 5445 | { |
| 5446 | while (!cur.next_sibling() && cur != n) |
| 5447 | cur = cur.parent(); |
| 5448 | |
| 5449 | if (cur != n) cur = cur.next_sibling(); |
| 5450 | } |
| 5451 | } |
| 5452 | |
| 5453 | return result; |
| 5454 | } |
| 5455 | |
| 5456 | default: |
| 5457 | return xpath_string(); |
| 5458 | } |
| 5459 | } |
| 5460 | } |
| 5461 | |
| 5462 | unsigned int node_height(xml_node n) |
| 5463 | { |
no test coverage detected