Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // set package
- File * m_PackageData = new File(context_, m_pPackageFile, String("GameAssetsData.xml"));
- // Read content to memory
- char* retrievedsource=new char[m_GameAssetsDataEntry->size_];
- m_PackageData->Read (retrievedsource, m_GameAssetsDataEntry->size_);
- // Create new xml document
- pugi::xml_document doc;
- // You can use load_buffer_inplace to load document from mutable memory block; the block's lifetime must exceed that of document
- char* buffer = new char(m_GameAssetsDataEntry->size_);
- memcpy(buffer, retrievedsource, m_GameAssetsDataEntry->size_);
- // The block can be allocated by any method; the block is modified during parsing
- pugi::xml_parse_result result = doc.load_buffer_inplace(buffer,m_GameAssetsDataEntry->size_);
- // Exit if error
- if (result.status!=pugi::status_ok)
- {
- URHO3D_LOGERROR ("Something wrong with file");
- return false;
- }
- // Get XML root if it exist, if not exit
- pugi::xml_node GameAssetRoot=doc.first_child();
- if(!GameAssetRoot)
- {
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment