MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / xpath_string string_value

Function xpath_string string_value

lib/pugixml/src/pugixml.cpp:7967–8019  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7965 }
7966
7967 PUGI__FN xpath_string string_value(const xpath_node& na, xpath_allocator* alloc)
7968 {
7969 if (na.attribute())
7970 return xpath_string::from_const(na.attribute().value());
7971 else
7972 {
7973 xml_node n = na.node();
7974
7975 switch (n.type())
7976 {
7977 case node_pcdata:
7978 case node_cdata:
7979 case node_comment:
7980 case node_pi:
7981 return xpath_string::from_const(n.value());
7982
7983 case node_document:
7984 case node_element:
7985 {
7986 xpath_string result;
7987
7988 // element nodes can have value if parse_embed_pcdata was used
7989 if (n.value()[0])
7990 result.append(xpath_string::from_const(n.value()), alloc);
7991
7992 xml_node cur = n.first_child();
7993
7994 while (cur && cur != n)
7995 {
7996 if (cur.type() == node_pcdata || cur.type() == node_cdata)
7997 result.append(xpath_string::from_const(cur.value()), alloc);
7998
7999 if (cur.first_child())
8000 cur = cur.first_child();
8001 else if (cur.next_sibling())
8002 cur = cur.next_sibling();
8003 else
8004 {
8005 while (!cur.next_sibling() && cur != n)
8006 cur = cur.parent();
8007
8008 if (cur != n) cur = cur.next_sibling();
8009 }
8010 }
8011
8012 return result;
8013 }
8014
8015 default:
8016 return xpath_string();
8017 }
8018 }
8019 }
8020
8021 PUGI__FN bool node_is_before_sibling(xml_node_struct* ln, xml_node_struct* rn)
8022 {

Callers

nothing calls this directly

Calls 9

xpath_stringFunction · 0.85
attributeMethod · 0.80
nodeMethod · 0.80
first_childMethod · 0.80
next_siblingMethod · 0.80
parentMethod · 0.80
valueMethod · 0.45
typeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected