X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=c%2B%2B0x%2Fsimple.cpp;h=c95bc437c6bc81fc51d5faf8d613d9485b66683b;hb=32a15e16a82ca8382ad39076cd942d6eb8242d55;hp=a5e7894ccfe0d66cc82d61dfe97b68bd884b96a9;hpb=8dd31132b249ab02168c61875dadd7eb18300566;p=xml-template 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;