cocos2d-x 中xml解析

前端之家收集整理的这篇文章主要介绍了cocos2d-x 中xml解析前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<Android> <301 name="yh" qq="2788"> <sdk>11</sdk> <native>11</native> </301> <302> <sdk>22</sdk> <native>22</native> </302> </Android> // C++ #include "tinyxml2/tinyxml2.h" using namespace tinyxml2; XMLDocument* myDocment = new XMLDocument(); myDocment->LoadFile("config.xml"); XMLElement* rootElement = myDocment->RootElement(); XMLElement* pid = rootElement->FirstChildElement(); while (pid) { log(pid->Name()); XMLElement* element = pid->FirstChildElement(); const XMLAttribute *attr = pid->FirstAttribute(); while (attr) { log(attr->Name()); log(attr->Value()); attr = attr->Next(); } while (element) { log(element->Name()); log(element->GetText()); element = element->NextSiblingElement(); } log("\n\n"); pid = pid->NextSiblingElement(); } 原文链接:https://www.f2er.com/cocos2dx/346361.html

猜你在找的Cocos2d-x相关文章