• xml文件的解析


    1. xml文件的解析

     1 void CDataMgr::readStringData()
     2 {
     3 std::string xml_name = "config/string.xml";
     4 TiXmlDocument * xmlDoc = new TiXmlDocument( xml_name.c_str() );
     5 unsigned long nLength = 0;
     6 char * pBuffer = ( char * )cocos2d::CCFileUtils::sharedFileUtils()->getFileData( xml_name.c_str(),"rb", &nLength );
     7 xmlDoc->loadMemory( pBuffer, nLength );
     8 
     9 int index = 0;
    10 TiXmlElement * RootElement = xmlDoc->RootElement();
    11 for ( TiXmlElement * rootelement = RootElement->FirstChildElement(); rootelement != 0; rootelement = rootelement->NextSiblingElement() )
    12 {
    13 if ( index == 0 ) { index ++; continue; }
    14 
    15 int id = 0;
    16 rootelement->QueryIntAttribute( "id", &id );
    17 std::string value = rootelement->Attribute( "value" );
    18 mMapString[ id ] = value;
    19 }
    20 CC_SAFE_DELETE( pBuffer );
    21 delete xmlDoc;
    22 }
  • 相关阅读:
    web测试--安全性
    web测试--链接测试
    web测试--兼容性
    web测试--界面和易用性
    web测试--返回键、回车键、刷新键
    web测试--查询结果
    列表标签代码解析
    备份
    java格式化时间
    js往div里添加table
  • 原文地址:https://www.cnblogs.com/alenoscar/p/4353182.html
Copyright © 2020-2023  润新知