Preserve order semantics for child_value/text when using parse_embed_pcdata
The performance cost is probably negligible and this means we treat embedded value as the first child consistently.
This commit is contained in:
parent
85238132d3
commit
4f3be76167
@ -5486,14 +5486,14 @@ namespace pugi
|
|||||||
{
|
{
|
||||||
if (!_root) return PUGIXML_TEXT("");
|
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
|
// element nodes can have value if parse_embed_pcdata was used
|
||||||
if (PUGI__NODETYPE(_root) == node_element && _root->value)
|
if (PUGI__NODETYPE(_root) == node_element && _root->value)
|
||||||
return _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("");
|
return PUGIXML_TEXT("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6237,14 +6237,14 @@ namespace pugi
|
|||||||
{
|
{
|
||||||
if (!_root || impl::is_text_node(_root)) return _root;
|
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
|
// element nodes can have value if parse_embed_pcdata was used
|
||||||
if (PUGI__NODETYPE(_root) == node_element && _root->value)
|
if (PUGI__NODETYPE(_root) == node_element && _root->value)
|
||||||
return _root;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user