libxml2_ZC积累

1、Qt5.3.2(VS2010 OpenGL)

  1.1、查找节点的 带NameSpace的属性

  参考网址:https://stackoverflow.com/questions/7872413/how-to-get-attributes-in-libxml2-and-save-in-stl-map-for-c

QString TtuYuan::NodeNsAttr(xmlNode* _pNode, xmlChar* _pcAttrName)
{
    QString strRst = "";
    for (xmlAttr* attr=_pNode->properties; attr!= NULL; attr=attr->next)
    {
        if ( (0 == xmlStrcasecmp(_pcAttrName, attr->name)) && (attr->ns != NULL) )
        {
            xmlChar *pcAttrValue = xmlGetNsProp(_pNode, attr->name, attr->ns->href);
            strRst = (char*)pcAttrValue;
        }
    }
    return strRst;
}

  1.2、strcasecmp是 不区分大小写的,strcmp是区分大小写的,可以写测试代码 看下结果

2、

3、

4、

5、

原文地址:https://www.cnblogs.com/cppskill/p/8249826.html