| 6930 | } |
| 6931 | |
| 6932 | PUGI__FN xpath_string string_value(const xpath_node& na, xpath_allocator* alloc) |
| 6933 | { |
| 6934 | if (na.attribute()) |
| 6935 | return xpath_string::from_const(na.attribute().value()); |
| 6936 | else |
| 6937 | { |
| 6938 | xml_node n = na.node(); |
| 6939 | |
| 6940 | switch (n.type()) |
| 6941 | { |
| 6942 | case node_pcdata: |
| 6943 | case node_cdata: |
| 6944 | case node_comment: |
| 6945 | case node_pi: |
| 6946 | return xpath_string::from_const(n.value()); |
| 6947 | |
| 6948 | case node_document: |
| 6949 | case node_element: |
| 6950 | { |
| 6951 | xpath_string result; |
| 6952 | |
| 6953 | xml_node cur = n.first_child(); |
| 6954 | |
| 6955 | while (cur && cur != n) |
| 6956 | { |
| 6957 | if (cur.type() == node_pcdata || cur.type() == node_cdata) |
| 6958 | result.append(xpath_string::from_const(cur.value()), alloc); |
| 6959 | |
| 6960 | if (cur.first_child()) |
| 6961 | cur = cur.first_child(); |
| 6962 | else if (cur.next_sibling()) |
| 6963 | cur = cur.next_sibling(); |
| 6964 | else |
| 6965 | { |
| 6966 | while (!cur.next_sibling() && cur != n) |
| 6967 | cur = cur.parent(); |
| 6968 | |
| 6969 | if (cur != n) cur = cur.next_sibling(); |
| 6970 | } |
| 6971 | } |
| 6972 | |
| 6973 | return result; |
| 6974 | } |
| 6975 | |
| 6976 | default: |
| 6977 | return xpath_string(); |
| 6978 | } |
| 6979 | } |
| 6980 | } |
| 6981 | |
| 6982 | PUGI__FN bool node_is_before_sibling(xml_node_struct* ln, xml_node_struct* rn) |
| 6983 | { |
nothing calls this directly
no test coverage detected