From: sgunderson@bigfoot.com <> Date: Wed, 21 Sep 2011 19:23:59 +0000 (+0200) Subject: Fix #id handling in the C++0x version. X-Git-Url: https://git.sesse.net/?p=xml-template;a=commitdiff_plain;h=32a15e16a82ca8382ad39076cd942d6eb8242d55 Fix #id handling in the C++0x version. --- diff --git a/c++0x/simple.cpp b/c++0x/simple.cpp index a5e7894..c95bc43 100644 --- a/c++0x/simple.cpp +++ b/c++0x/simple.cpp @@ -34,24 +34,20 @@ class Substitute : public Directive { bool processed = false; if (child->type == XML_ELEMENT_NODE) { - xmlElement *elem = reinterpret_cast(child); - // Find the ID, if any. string id; -#if 0 - for (xmlAttribute *attr = elem->attributes; attr != NULL; attr = attr->nexth) { + for (xmlAttr *attr = child->properties; attr != NULL; attr = attr->next) { // FIXME: namespace if (strcmp(reinterpret_cast(attr->name), "id") != 0) { continue; } - id = xmlNodeGetContent(attr->content); + id = reinterpret_cast(xmlNodeGetContent(attr->children)); } -#endif // Check all substitutions to see if we found anything appropriate. for (auto it : substitution_map) { if (it.first == reinterpret_cast(child->name) || - (!id.empty() && ("#" + it.first) == id)) { + (!id.empty() && it.first == ("#" + id))) { it.second->process(child, clean); processed = true; break;