summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index f447e97..158a24d 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -5486,14 +5486,14 @@ namespace pugi
{
if (!_root) return PUGIXML_TEXT("");
- for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling)
- if (impl::is_text_node(i) && i->value)
- return i->value;
-
// element nodes can have value if parse_embed_pcdata was used
if (PUGI__NODETYPE(_root) == node_element && _root->value)
return _root->value;
+ for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling)
+ if (impl::is_text_node(i) && i->value)
+ return i->value;
+
return PUGIXML_TEXT("");
}
@@ -6237,14 +6237,14 @@ namespace pugi
{
if (!_root || impl::is_text_node(_root)) return _root;
- for (xml_node_struct* node = _root->first_child; node; node = node->next_sibling)
- if (impl::is_text_node(node))
- return node;
-
// element nodes can have value if parse_embed_pcdata was used
if (PUGI__NODETYPE(_root) == node_element && _root->value)
return _root;
+ for (xml_node_struct* node = _root->first_child; node; node = node->next_sibling)
+ if (impl::is_text_node(node))
+ return node;
+
return 0;
}