summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-27 21:57:39 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-27 21:57:39 +0000
commit3472d0272c8353a7aa6d583651a79dd5db50803f (patch)
tree72c49f04a92629259b3972e6823d7ab27ba8922e
parentbf92a09870c146223657be6d035d57423aa85721 (diff)
XPath: Fixed string-value evaluation for node set
git-svn-id: http://pugixml.googlecode.com/svn/trunk@180 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--src/pugixpath.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp
index d94fb34..68ddfd0 100644
--- a/src/pugixpath.cpp
+++ b/src/pugixpath.cpp
@@ -97,25 +97,30 @@ namespace
{
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)
- result += c.value();
-
- if (c.first_child())
- c = c.first_child();
- else if (c.next_sibling())
- c = c.next_sibling();
- else
+ do
{
- while (c && c != n) c = c.parent();
+ if (cur.type() == node_pcdata || cur.type() == node_cdata)
+ result += cur.value();
- if (c == n) break;
+ if (cur.first_child())
+ cur = cur.first_child();
+ else if (cur.next_sibling())
+ cur = cur.next_sibling();
+ else
+ {
+ // Borland C++ workaround
+ while (!cur.next_sibling() && cur != n && (bool)cur.parent())
+ cur = cur.parent();
- c = c.next_sibling();
+ if (cur != n)
+ cur = cur.next_sibling();
+ }
}
+ while (cur && cur != n);
}
return result;
@@ -3332,6 +3337,7 @@ namespace pugi
// This is either a function call, or not - if not, we shall proceed with location path
const char* state = m_lexer.state();
+ // $$$ signed char
while (*state && *state <= 32) ++state;
if (*state != '(') return parse_location_path();