summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-21 20:46:57 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2009-10-21 20:46:57 +0000
commit1b0a27c7f4dcee56422cfa405feeac7c4527ea40 (patch)
treedd0ce419c5e8c319962ca0e1080384a51bff8588 /src
parent9233e8605512d8ff887afbe6e55dc3db78e55ca9 (diff)
XPath: Fixed lang() function
git-svn-id: http://pugixml.googlecode.com/svn/trunk@175 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src')
-rw-r--r--src/pugixpath.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp
index ac4de31..5071fa0 100644
--- a/src/pugixpath.cpp
+++ b/src/pugixpath.cpp
@@ -1944,9 +1944,7 @@ namespace pugi
std::string lang = m_left->eval_string(c);
- xml_node n = c.n.node();
-
- while (n.type() != node_document)
+ for (xml_node n = c.n.node(); n; n = n.parent())
{
xml_attribute a = n.attribute("xml:lang");
@@ -1955,9 +1953,9 @@ namespace pugi
const char* value = a.value();
// strnicmp / strncasecmp is not portable
- for (std::string::iterator it = lang.begin(); it != lang.end(); ++it)
+ for (const char* lit = lang.c_str(); *lit; ++lit)
{
- if (tolower(*it) != tolower(*value)) return false;
+ if (tolower(*lit) != tolower(*value)) return false;
++value;
}