XPath: Fixed string-value evaluation for node set

git-svn-id: http://pugixml.googlecode.com/svn/trunk@180 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2009-10-27 21:57:39 +00:00
parent bf92a09870
commit 3472d0272c

View File

@ -97,26 +97,31 @@ namespace
{ {
std::string result; std::string result;
xml_node c = n.first_child(); xml_node cur = n.first_child();
while (c) if (cur)
{ {
if (c.type() == node_pcdata || c.type() == node_cdata) do
result += c.value(); {
if (cur.type() == node_pcdata || cur.type() == node_cdata)
result += cur.value();
if (c.first_child()) if (cur.first_child())
c = c.first_child(); cur = cur.first_child();
else if (c.next_sibling()) else if (cur.next_sibling())
c = c.next_sibling(); cur = cur.next_sibling();
else else
{ {
while (c && c != n) c = c.parent(); // Borland C++ workaround
while (!cur.next_sibling() && cur != n && (bool)cur.parent())
cur = cur.parent();
if (c == n) break; if (cur != n)
cur = cur.next_sibling();
c = c.next_sibling();
} }
} }
while (cur && cur != n);
}
return result; return result;
} }
@ -3332,6 +3337,7 @@ namespace pugi
// This is either a function call, or not - if not, we shall proceed with location path // This is either a function call, or not - if not, we shall proceed with location path
const char* state = m_lexer.state(); const char* state = m_lexer.state();
// $$$ signed char
while (*state && *state <= 32) ++state; while (*state && *state <= 32) ++state;
if (*state != '(') return parse_location_path(); if (*state != '(') return parse_location_path();