XPath: Fixed lang() function
git-svn-id: http://pugixml.googlecode.com/svn/trunk@175 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
parent
9233e86055
commit
1b0a27c7f4
@ -1944,9 +1944,7 @@ namespace pugi
|
|||||||
|
|
||||||
std::string lang = m_left->eval_string(c);
|
std::string lang = m_left->eval_string(c);
|
||||||
|
|
||||||
xml_node n = c.n.node();
|
for (xml_node n = c.n.node(); n; n = n.parent())
|
||||||
|
|
||||||
while (n.type() != node_document)
|
|
||||||
{
|
{
|
||||||
xml_attribute a = n.attribute("xml:lang");
|
xml_attribute a = n.attribute("xml:lang");
|
||||||
|
|
||||||
@ -1955,9 +1953,9 @@ namespace pugi
|
|||||||
const char* value = a.value();
|
const char* value = a.value();
|
||||||
|
|
||||||
// strnicmp / strncasecmp is not portable
|
// 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;
|
++value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user