Merge 78900703a6 into ad3b492c1a
This commit is contained in:
commit
0ca89f4af3
@ -3358,7 +3358,7 @@ PUGI__NS_BEGIN
|
|||||||
if (!PUGI__OPTSET(parse_trim_pcdata))
|
if (!PUGI__OPTSET(parse_trim_pcdata))
|
||||||
s = mark;
|
s = mark;
|
||||||
|
|
||||||
if (cursor->parent || PUGI__OPTSET(parse_fragment))
|
if ((cursor->parent && !PUGI__OPTSET(parse_embed_pcdata)) || PUGI__OPTSET(parse_fragment))
|
||||||
{
|
{
|
||||||
PUGI__PUSHNODE(node_pcdata); // Append a new node on the tree.
|
PUGI__PUSHNODE(node_pcdata); // Append a new node on the tree.
|
||||||
cursor->value = s; // Save the offset.
|
cursor->value = s; // Save the offset.
|
||||||
@ -3367,6 +3367,14 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
PUGI__POPNODE(); // Pop since this is a standalone.
|
PUGI__POPNODE(); // Pop since this is a standalone.
|
||||||
|
|
||||||
|
if (!*s) break;
|
||||||
|
}
|
||||||
|
else if (cursor->parent && PUGI__OPTSET(parse_embed_pcdata) && !cursor->value)
|
||||||
|
{
|
||||||
|
cursor->value = s; // Save the offset.
|
||||||
|
|
||||||
|
s = strconv_pcdata(s);
|
||||||
|
|
||||||
if (!*s) break;
|
if (!*s) break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -5450,6 +5458,9 @@ namespace pugi
|
|||||||
PUGI__FN const char_t* xml_node::child_value() const
|
PUGI__FN const char_t* xml_node::child_value() const
|
||||||
{
|
{
|
||||||
if (!_root) return PUGIXML_TEXT("");
|
if (!_root) return PUGIXML_TEXT("");
|
||||||
|
|
||||||
|
if ((_root->header & impl::xml_memory_page_type_mask) + 1 == node_element && _root->value)
|
||||||
|
return _root->value;
|
||||||
|
|
||||||
for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling)
|
for (xml_node_struct* i = _root->first_child; i; i = i->next_sibling)
|
||||||
if (impl::is_text_node(i) && i->value)
|
if (impl::is_text_node(i) && i->value)
|
||||||
@ -6198,6 +6209,9 @@ namespace pugi
|
|||||||
{
|
{
|
||||||
if (!_root || impl::is_text_node(_root)) return _root;
|
if (!_root || impl::is_text_node(_root)) return _root;
|
||||||
|
|
||||||
|
if ((_root->header & impl::xml_memory_page_type_mask) + 1 == node_element && _root->value)
|
||||||
|
return _root;
|
||||||
|
|
||||||
for (xml_node_struct* node = _root->first_child; node; node = node->next_sibling)
|
for (xml_node_struct* node = _root->first_child; node; node = node->next_sibling)
|
||||||
if (impl::is_text_node(node))
|
if (impl::is_text_node(node))
|
||||||
return node;
|
return node;
|
||||||
|
|||||||
@ -158,6 +158,9 @@ namespace pugi
|
|||||||
// is a valid document. This flag is off by default.
|
// is a valid document. This flag is off by default.
|
||||||
const unsigned int parse_fragment = 0x1000;
|
const unsigned int parse_fragment = 0x1000;
|
||||||
|
|
||||||
|
// Experimental API for reduced memory consumption
|
||||||
|
const unsigned int parse_embed_pcdata = 0x0800;
|
||||||
|
|
||||||
// The default parsing mode.
|
// The default parsing mode.
|
||||||
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
|
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
|
||||||
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
|
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user