cocos2d-x之xml文件读取初试

auto doc=new tinyxml2::XMLDocument();

    doc->Parse(FileUtils::getInstance()->getStringFromFile("data_1.xml").c_str());

    auto root=doc->RootElement();

    

    for (auto e=root->FirstChildElement();e;e=e->NextSiblingElement()) {

        std::string str;

        for (auto attr=e->FirstAttribute();attr;attr=attr->Next()) {

            str+=attr->Name();

            str+=":";

            str+=attr->Value();

            str+=",";

        }

        log("%s",str.c_str());

    }

原文地址:https://www.cnblogs.com/daochong/p/5233209.html