本文整理汇总了C++中tinyxml2::XMLDocument::FirstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLDocument::FirstChild方法的具体用法?C++ XMLDocument::FirstChild怎么用?C++ XMLDocument::FirstChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinyxml2::XMLDocument
的用法示例。
在下文中一共展示了XMLDocument::FirstChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseDoc
int parseDoc()
{
XMLNode * root = doc.FirstChild();
if(root == nullptr)
{
return XML_ERROR_FILE_READ_ERROR;
}
XMLElement * tuixml = root->FirstChildElement("tuixml");
if(tuixml == nullptr)
{
return XML_ERROR_PARSING_ELEMENT;
}
XMLElement * temp = tuixml->FirstChildElement();
layers.push_back(layer);
createElementLayers(temp);
}
示例2:
/**
* @brief This is the default constructor for the XMLLoader. This sets up the root
* node and initalises the tinyxml2::XMLElement to start on the first save slot
*/
XMLLoader(){
string path = "Assets/save_data";
string ext = ".sav";
ext = ".xml";
string result = path + ext;
//xmlDoc.LoadFile(result.c_str());
//Why does this load the old save_data all the time
if(xmlDoc.LoadFile(result.c_str()) == tinyxml2::XML_ERROR_FILE_NOT_FOUND)
GenerateSaveFile();
tinyxml2::XMLNode *pRoot = xmlDoc.FirstChild();
//cout << string_to_int(s) << endl;
saveGame = pRoot->FirstChildElement("SaveGame");
if (saveGame == nullptr) throw tinyxml2::XML_ERROR_FILE_READ_ERROR;
loadSaveSlots();
/*
tinyxml2::XMLElement * slot = saveGame->FirstChildElement("SaveSlot1");
if (slot == nullptr) throw tinyxml2::XML_ERROR_FILE_READ_ERROR;
tinyxml2::XMLElement * level = slot->FirstChildElement("Levels");
if (level == nullptr) throw tinyxml2::XML_ERROR_FILE_READ_ERROR;
tinyxml2::XMLElement * level_bool = level->FirstChildElement("LVL3");
if (level_bool == nullptr) throw tinyxml2::XML_ERROR_FILE_READ_ERROR;
string l_data = level_bool->GetText();
cout << string_to_int(l_data) << endl;
*/
/*
loadSaveSlots();
*/
/*
const string image_ext = texture->Attribute("EXT");
const string file_name = image_name + '.' + image_ext;*/
}