data files packed in the apk cannot be read out directly through standard file operations in android.
has to use FileUtils to load the file into memory first, then use XMLDocument::parse() to retrieve data.
FileUtils::getInstance()->addSearchPath("data");
std::string str = FileUtils::getInstance()->fullPathForFilename("somedata.xml");
tinyxml2::XMLDocument doc;
auto data = FileUtils::getInstance()->getDataFromFile(str);
auto ret = doc.Parse((const char*)data.getBytes(), data.getSize());
//auto ret = doc.LoadFile(str.c_str());
if (ret != tinyxml2::XML_NO_ERROR)
{
return false;
}
the codes above are based on cocos2d-x 3.2.