Pugixml - parse namespace with prefix mapping and without prefix mappig

℡╲_俬逩灬. 提交于 2019-12-02 02:16:44

I think your best bet is to just ignore namespaces and find the node by local name. You can do it with XPath like this:

node.select_single_node(".[local-name()='local-modification-time']")

Or you can just use C++ like this:

pugi::xml_node child_by_local_name(pugi::xml_node node, const char* name)
{
    for (pugi::xml_node child = node.first_child(); child; child = child.next_sibling())
    {
        if (strcmp(child.name(), name) == 0)
            return child;

        const char* colon = strchr(child.name(), ':');

        if (colon && strcmp(colon + 1, name) == 0)
            return child;
    }

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