From 1b0a27c7f4dcee56422cfa405feeac7c4527ea40 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 21 Oct 2009 20:46:57 +0000 Subject: XPath: Fixed lang() function git-svn-id: http://pugixml.googlecode.com/svn/trunk@175 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixpath.cpp | 8 +++----- 1 file 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; } -- cgit v1.2.3