Use pugiXML to rename nodes based on a std::map

社会主义新天地 提交于 2019-12-04 15:39:01

The variables found and n are never declared. Declare those variables as the appropriate type before that loop so that section of code looks like:

EDIT: changed the code slightly, the if statement should check the value of found after it has been set.

pugi::xml_node found, n;

for (auto& eb: mapb) {
    // change node name if mapping found
    found = tagmaps.find(n.name());
    if((found != tagmaps.end()) {
        n.set_name(found->second.c_str());
    }
}

Also, I presume n should be set to a particular node inside the loop (at the moment it has no value). Consider renaming n to something else to make it apparent what this variable should be holding.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!