void rss_feed_parse(const std::string &feed) { XMLDocument doc; doc.Parse(feed.c_str()); XMLElement *rss = doc.FirstChildElement("rss"); if (rss) { XMLElement *channel = rss->FirstChildElement("channel"); if (channel) { for (XMLElement *article = channel->FirstChildElement("item"); article; article = article->NextSiblingElement("item")) { XMLElement *title = article->FirstChildElement("title"); XMLElement *link = article->FirstChildElement("link"); std::cout << title->GetText() << std::endl; std::cout << link->GetText() << std::endl; std::cout << std::endl; } } } }
int SPECAPIENTRY readSpecs(const char* xmlData, unsigned int bytes, Function** functions, unsigned int* functionCount, Constant** constants, unsigned int* constantsCount) { XMLDocument document; if (document.Parse(xmlData, bytes) == XMLError::XML_NO_ERROR) { XMLElement* registry = document.FirstChildElement("registry"); if (registry) { ObtainConstants(registry, constantsCount, constants); ObtainCommands(registry, functionCount, functions); ObtainFeatures(registry, functionCount, functions); ObtainExtensions(registry, functionCount, functions); } } return 0; }
bool TiledMap::loadMap(string source) { XMLDocument map; map.LoadFile(source.data()); XMLElement* map_info = map.FirstChildElement("map"); this->version = map_info->Attribute("version"); this->orientation = map_info->Attribute("orientation"); this->width = this->stringToInt(map_info->Attribute("width")); this->height = this->stringToInt(map_info->Attribute("height")); this->tilewidth = this->stringToInt(map_info->Attribute("tilewidth")); this->tileheight = this->stringToInt(map_info->Attribute("tileheight")); this->loadTilesets(&map); this->loadLayers(&map); this->loadObjectGroups(&map); }
void Scene::loadModels(XMLDocument& doc){ // Load all models paths XMLElement *models = doc.FirstChildElement("scene")->FirstChildElement("models"); for (const XMLElement* model = models->FirstChildElement(); model != NULL; model = model->NextSiblingElement()) { string path = model->FirstChildElement("path")->GetText(); // Translate glm::vec3 translate = glm::vec3(model->FirstChildElement("translate")->FindAttribute("x")->FloatValue(), model->FirstChildElement("translate")->FindAttribute("y")->FloatValue(), model->FirstChildElement("translate")->FindAttribute("z")->FloatValue()); // Scale glm::vec3 scale = glm::vec3(model->FirstChildElement("scale")->FindAttribute("x")->FloatValue(), model->FirstChildElement("scale")->FindAttribute("y")->FloatValue(), model->FirstChildElement("scale")->FindAttribute("z")->FloatValue()); // Rotate glm::vec3 rotate; float rotateAngle; // Only if a rotate parameter is set in the XML if (model->FirstChildElement("rotate")) { rotate = glm::vec3(model->FirstChildElement("rotate")->FindAttribute("x")->FloatValue(), model->FirstChildElement("rotate")->FindAttribute("y")->FloatValue(), model->FirstChildElement("rotate")->FindAttribute("z")->FloatValue()); rotateAngle = atof(model->FirstChildElement("rotate")->GetText()); } else { rotate = glm::vec3(0.0, 0.0, 0.0); rotateAngle = 0; } int interactionDialogue = -1; //Default state no interaction possible if(model->FirstChildElement("interaction")){ interactionDialogue = atoi(model->FirstChildElement("interaction")->GetText()); } _models.push_back(Model(path, translate, scale, rotate, rotateAngle, interactionDialogue)); } }
set<string> compareWithStorageFile(const string& path) { map<string, time_t> storage; XMLDocument doc; if (doc.LoadFile(gStorage.c_str())!=XML_NO_ERROR) { cerr << "Error reading XML!" << endl; doc.PrintError(); } auto root = doc.FirstChildElement(); auto file = root->FirstChildElement(); while (file) { string name = file->FirstAttribute()->Value(); auto time = file->Attribute("last_modif"); storage[name] = stoll(time); file = file->NextSiblingElement(); } set<string> dst; fs::path current(path); fs::recursive_directory_iterator end; cout << "Go to directory iterator: " << current.string() << " -> " << endl; for (fs::recursive_directory_iterator item(current); item != end; ++item) { if (!fs::is_directory(item->status())) { fs::path filename = item->path(); time_t time = fs::last_write_time(filename); auto sfile = filename.string().substr(current.string().size()); if (storage.count(sfile)>0) { if (storage[sfile]!=time) { dst.insert(sfile); cout << "[mod] " << sfile << endl; } } else { dst.insert(sfile); cout << "[new] " << sfile << endl; } } } return dst; }
void XmlReader::xmlReadMeetingInfo(void) { XMLDocument doc; doc.LoadFile(m_filename); if (doc.ErrorID() != 0) { printf("read xml error!\n"); return; } XMLElement *root = doc.FirstChildElement("root"); XMLElement *meetings = root->FirstChildElement("meetings"); for (XMLElement *meeting = meetings->FirstChildElement("meeting"); meeting; meeting = meeting->NextSiblingElement("meeting")) { XMLElement *meeting_id = meeting->FirstChildElement("meeting_id"); XMLElement *meeting_name = meeting->FirstChildElement("meeting_name"); XMLElement *start_time = meeting->FirstChildElement("start_time"); XMLElement *end_time = meeting->FirstChildElement("end_time"); XMLElement *meeting_conferrees = meeting->FirstChildElement("meeting_conferrees"); printf("meeting_id: %s\n", meeting_id->GetText()); printf("meeting_name: %s\n", meeting_name->GetText()); printf("start_time: %s\n", start_time->GetText()); printf("end_time: %s\n", end_time->GetText()); printf("conferreess:\n"); if (meeting_conferrees) { for (XMLElement *meeting_conferree = meeting_conferrees->FirstChildElement("meeting_conferree"); meeting_conferree; meeting_conferree = meeting_conferree->NextSiblingElement("meeting_conferree")) { XMLElement *user2_id = meeting_conferree->FirstChildElement("user_id"); XMLElement *user2_account = meeting_conferree->FirstChildElement("user_acount"); XMLElement *user2_name = meeting_conferree->FirstChildElement("user_name"); printf("user_id: %s\n", user2_id->GetText()); printf("user_account: %s\n", user2_account->GetText()); printf("user_name: %s\n", user2_name->GetText()); } } printf("\n"); } }
bool XMLOperation::fixAttribute1(const char *filePath, const char *elementId, const char *name, const char *value,const char* defId,bool fullPath) { std::string fullpath_str = filePath; if (!fullPath) { fullpath_str.clear(); fullpath_str = cocos2d::CCFileUtils::sharedFileUtils()->fullPathForFilename(filePath); } cout<<"修改文件读取的路径:"<<fullpath_str<<endl; XMLDocument *pDoc = new XMLDocument(); pDoc->LoadFile(fullpath_str.c_str()); XMLElement *rootElement = pDoc->FirstChildElement(); XMLElement *xElement = rootElement->FirstChildElement(); bool isFixed = false; while (xElement)//一条记录 { if (strcmp(xElement->Attribute(defId),elementId) == 0) { xElement->SetAttribute(name, value); // cout<<"属性id 值:"<<xElement->Attribute(defId)<<"比较id "<<elementId<<" name "<<name<<" value:"<<value<<endl; if (pDoc->SaveFile(fullpath_str.c_str()) == XML_SUCCESS) { isFixed = true; } break; } xElement = xElement->NextSiblingElement(); } delete pDoc; return isFixed; }
void XMLOperation::readXML(const char *filePath) { XMLDocument *pDoc = new XMLDocument(); pDoc->LoadFile(filePath); XMLElement *rootElement = pDoc->FirstChildElement(); XMLElement *xElement = rootElement->FirstChildElement(); while (xElement) { cout<<xElement->Name()<<endl; XMLOperation::readAttribute(xElement, _xmlDic); xElement = xElement->NextSiblingElement(); } delete pDoc; }
int main (int argc, char const* argv[]) { XMLDocument doc; doc.LoadFile("resource/example4.xml"); XMLElement* element = doc.FirstChildElement("MyApp"); element = element->FirstChildElement("Messages")->FirstChildElement("value"); if(element){ float value; element->QueryFloatText(&value); cout<< value+2 << endl; }else{ cout<<"not found"<<endl; } return 0; }
void ImageMapWorldCreator::readXML(MapDirectory* mapDirectory, Engine* engine, SDL_Surface* surface, World* world) { XMLDocument document; if (document.LoadFile(mapDirectory->getXMLPath().c_str()) == XML_NO_ERROR) { XMLElement* mapElement = document.FirstChildElement("map"); if (mapElement) { XMLElement* backgroundsElement = mapElement->FirstChildElement("backgrounds"); XMLElement* texturesElement = mapElement->FirstChildElement("textures"); if (texturesElement) { readTexturesElement(texturesElement, surface); } if (backgroundsElement) { readBackgroundsElement(backgroundsElement, engine, mapDirectory, world); } } } else { cout << document.GetErrorStr1() << endl; cout << document.GetErrorStr2() << endl; } }
// TODO : error checking Result loadShortcut(shortcut_s* s, char* path) { if(!s || !path)return -1; XMLDocument doc; if(doc.LoadFile(path))return -2; XMLElement* shortcut = doc.FirstChildElement("shortcut"); if(shortcut) { XMLElement* executable = shortcut->FirstChildElement("executable"); if(executable) { const char* str = executable->GetText(); if(str) { s->executable = (char*)malloc(strlen(str) + 1); if(s->executable) strcpy(s->executable, str); } } if(!s->executable) return -3; XMLElement* descriptor = shortcut->FirstChildElement("descriptor"); const char* descriptor_path = path; if(descriptor) descriptor_path = descriptor->GetText(); if(descriptor_path) { s->descriptor = (char*)malloc(strlen(descriptor_path) + 1); if(s->descriptor) strcpy(s->descriptor, descriptor_path); } loadXmlString(&s->icon, shortcut, "icon"); loadXmlString(&s->arg, shortcut, "arg"); loadXmlString(&s->name, shortcut, "name"); loadXmlString(&s->description, shortcut, "description"); loadXmlString(&s->author, shortcut, "author"); } else return -4; return 0; }
void highscore::reloadHighScore() { string playerNameTMP; int scoreTMP; // Clear highscore list first this->highScoreData.clear(); // Initialize XML reader XMLDocument xmlHighScore; XMLElement *nodeTransversal; xmlHighScore.LoadFile("score.xml"); // Get first child nodeTransversal = xmlHighScore.FirstChildElement("hs"); playerNameTMP = string(nodeTransversal->FirstChildElement("name")->GetText()); scoreTMP = atoi(nodeTransversal->FirstChildElement("score")->GetText()); this->addScore(playerNameTMP, scoreTMP); // Get all node while(true) { nodeTransversal = nodeTransversal->NextSiblingElement("hs"); if(nodeTransversal) { playerNameTMP = string(nodeTransversal->FirstChildElement("name")->GetText()); scoreTMP = atoi(nodeTransversal->FirstChildElement("score")->GetText()); this->addScore(playerNameTMP, scoreTMP); } else { break; } } // Sort highscore depend on its score this->highScoreData.sort(hsComp); }
void XmlReader::xmlReadMsmServerInfo(void) { XMLDocument doc; doc.LoadFile(m_filename); if (doc.ErrorID() != 0) { printf("read xml error!\n"); return; } XMLElement *root = doc.FirstChildElement("root"); XMLElement *msms = root->FirstChildElement("msms"); for (XMLElement *msm = msms->FirstChildElement("msm"); msm; msm = msm->NextSiblingElement("msm")) { XMLElement *msm_ip = msm->FirstChildElement("msm_ip"); XMLElement *msm_port = msm->FirstChildElement("msm_port"); printf("msm_ip: %s\n", msm_ip->GetText()); printf("msm_port: %s\n", msm_port->GetText()); } }
std::string SystemSettings::load(const K::File& file) { XMLDocument doc; doc.LoadFile( file.getAbsolutePath().c_str() ); XMLElement* nRoot = doc.FirstChildElement("KSynth"); if (nRoot == nullptr) {return "";} // list of all encountered problems; std::string problems; XMLElement* nSettings = nRoot->FirstChildElement("Settings"); if (!nSettings) {return "missing node for 'Settings'\n";} // sound-sink XMLElement* nSink = nSettings->FirstChildElement("SoundSink"); if (nSink) { std::string name = nSink->Attribute("name"); SoundSinkHardware* ss = SoundSinks::get().getHardwareSinkByName(name); if (ss) { setSoundSink(ss); } else { problems += "could not find a SoundSink named '"+name+"'\n"; } } else { problems += "no 'SoundSink' given\n"; } // refresh interval XMLElement* nGui = nSettings->FirstChildElement("GUI"); if (nGui) { XMLElement* nGuiRefresh = nGui->FirstChildElement("Refresh"); if (nGuiRefresh) { setGuiRefreshInterval(nGuiRefresh->IntAttribute("ms")); } } return problems; }
void XMLOperation::readXML1(const char *filePath) { CCLog("读取xml文件路径: %s",filePath); XMLDocument *pDoc = new XMLDocument(); pDoc->LoadFile(filePath); XMLElement *rootElement = pDoc->FirstChildElement(); XMLElement *xElement = rootElement->FirstChildElement(); while (xElement) { if (SHOW_MODULE) cout<<"<"<<xElement->Name()<<">"<<endl; XMLOperation::readAttribute1(xElement,_xmlDic1); xElement = xElement->NextSiblingElement(); } delete pDoc; }
bool Cursor::loadFromFile(const std::string &path) { // <cursor file="cursor.png"> // <point x="0" y="0"/> // </cursor> bool ok = false; XMLDocument doc; XMLError error = doc.LoadFile(path.c_str()); if (error != XML_NO_ERROR) { Error() << "opening cursor file \"" << path << "\": XML error = " << error; } else { const XMLElement *elem = doc.FirstChildElement("cursor"); if (!elem) { Error() << "no cursor element in file \"" << path << "\""; } else { const char *fileName = elem->Attribute("file"); if (!fileName) { Error() << "no file attribute in cursor element, in file \"" << path << "\""; } else { // TODO: Path class? getDirectory, getName, getFullPath, concatenating "/" std::string file = path.substr(0, path.find_last_of('/') + 1) + fileName; ok = loadFromFile(file, Point::parseXML(elem)); } } } return ok; }
void XMLConfig::readXML(const char* path){ XMLDocument doc; cout << "Reading file at: " << path << endl; doc.LoadFile(path); // arquivosDeEntrada XMLElement* arquivosDeEntrada = doc.FirstChildElement("aplicacao")->FirstChildElement("arquivosDeEntrada"); XMLNode* arquivo = arquivosDeEntrada->FirstChild(); while(arquivo != NULL){ XMLElement* arq = arquivo->ToElement(); if(strcmp(arq->Name(),"arquivoDaArena") == 0){ this->arena = File(arq->Attribute("nome"), arq->Attribute("caminho"), arq->Attribute("tipo")); } arquivo = arquivo->NextSibling(); } cout << "OK!"<<endl; }
int Level::loadMap(std::string mapName, Graphics &gfx) { XMLDocument doc; if (loadMap(mapName, &doc)) return 1; XMLElement *mapNode = doc.FirstChildElement("map"); setSizes(mapNode); XMLElement *tileSetNode = mapNode->FirstChildElement("tileset"); if (loadTileSets(tileSetNode, gfx)) return 1; XMLElement *layerNode = mapNode->FirstChildElement("layer"); while (layerNode) { XMLElement *dataNode = layerNode->FirstChildElement("data"); while (dataNode) { XMLElement *tileNode = dataNode->FirstChildElement("tile"); appendToTileList(tileNode); dataNode = dataNode->NextSiblingElement("data"); } layerNode = layerNode->NextSiblingElement("layer"); } XMLElement *objectGroupNode = mapNode->FirstChildElement("objectgroup"); while (objectGroupNode) { const char *name = objectGroupNode->Attribute("name"); if (strcmp(name, "collisions") == 0) { XMLElement *objectNode = objectGroupNode->FirstChildElement("object"); loadCollisionRects(objectNode); } else if(strcmp(name, "spawn points") == 0){ XMLElement *objectNode = objectGroupNode->FirstChildElement("object"); loadSpawnObjects(objectNode); } objectGroupNode = objectGroupNode->NextSiblingElement("objectgroup"); } return 0; }
/** * * Get runtime information of profiling * */ const std::vector<DividendLWSProfInfo> DividendTuningOptFileRoutines::getRunTimeInfo(std::string fname) { XMLDocument doc; std::vector<DividendLWSProfInfo> info; XMLError err = doc.LoadFile(fname.c_str()); DIVIDEND_EXIT_ERROR_ON(err!= XML_NO_ERROR, -1, "Failed to load file:%s", fname.c_str()); XMLElement* root = doc.FirstChildElement("DIVIDEND")->FirstChildElement("LWGS"); DIVIDEND_EXIT_ERROR_ON(root == NULL, -1, "Failed to find LWGS"); const XMLElement *node = root->FirstChildElement("Kernel"); DIVIDEND_WARN_ON(node==NULL, "No runtime info is contained at: %s", fname.c_str()); while (node) { info.push_back(processRuntimeInfo(node)); node = node->NextSiblingElement("Kernel"); } return info; }
int example_3() { static const char* xml = "<?xml version=\"1.0\"?>" "<!DOCTYPE PLAY SYSTEM \"play.dtd\">" "<PLAY>" "<TITLE>A Midsummer Night's Dream</TITLE>" "</PLAY>"; XMLDocument doc; doc.Parse( xml ); XMLElement* titleElement = doc.FirstChildElement( "PLAY" )->FirstChildElement( "TITLE" ); const char* title = titleElement->GetText(); printf( "Name of play (1): %s\n", title ); XMLText* textNode = titleElement->FirstChild()->ToText(); title = textNode->Value(); printf( "Name of play (2): %s\n", title ); return doc.ErrorID(); }
SkillAnimationData SkillAnimationDataFactory::loadSkillAnimationDataFromXMLFile(const char* animationId, const char* xmlFileName) { SkillAnimationData data; std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(xmlFileName); unsigned long dataSize = 0; unsigned char* pFileData = NULL; pFileData = (unsigned char*) CCFileUtils::sharedFileUtils()->getFileData(fullPath.c_str(), "r", &dataSize); // CCLOG("Empty file: %s", fullPath.c_str()); if (!pFileData) { // CCLOG("Empty file: %s", fullPath.c_str()); return data; } std::string fileContent; fileContent.assign(reinterpret_cast<const char*>( pFileData), dataSize); XMLDocument document; if( document.Parse(fileContent.c_str()) != XML_NO_ERROR) { CCLOG("Cannot parse file: %s", fullPath.c_str()); return data; } //Parse data XMLElement* docElement = document.FirstChildElement(); const XMLElement* result = XMLHelper::loadElementById(TAG_SKILL_ANIMATION, animationId, ATTRIBUTE_ID, docElement); if(result != NULL) { data = XMLSkillAnimationParser::loadData(result); } delete []pFileData; return data; }
bool LevelReader::readLevel(const std::string& fileName, LevelData& data) { XMLDocument xmlDoc; XMLError result = xmlDoc.LoadFile(fileName.c_str()); XMLCheckResult(result); XMLElement* map = xmlDoc.FirstChildElement("map"); if (map == nullptr) { g_logger->logError("LevelReader", "XML file could not be read, no map node found."); return false; } if (!readLevelProperties(map, data)) return false; if (!readFirstGridIDs(map, data)) return false; if (!readLayers(map, data)) return false; if (!readObjects(map, data)) return false; updateData(data); if (!checkData(data)) return false; return true; }
void Book::ParsePages(BLUnZip& zipfile) { std::vector<char> filter(std::numeric_limits<unsigned char>::max(), 1); for (unsigned char c : valid) { filter[c] = 0; } // spine.size(); or 7 for (unsigned int i = 0; i != spine.size(); i++) { TextVisitor tv; std::string page ( zipfile.ExtractToString( manifest[spine[i]]) ); XMLDocument doc; doc.Parse(page.c_str()); XMLElement* body = doc.FirstChildElement("html")->FirstChildElement("body"); body->Accept(&tv); for (auto& v : tv.GetText()) { alltext.push_back(v); } // clean up text, remove any random / corrupt characters // https://github.com/dietmarkuehl/cputube/blob/master/cpu/test/replace.cpp for (auto& text : alltext) {/* text.erase(std::remove_if(text.begin(), text.end(), [&](unsigned char c) { return filter[c]; } ), text.end()); */ std::replace_if(text.begin(), text.end(), [&](unsigned char c) { return filter[c]; }, '\''); } } }
void load_items() { static const std::string itemDatabase = config::res_path("Items.xml"); XMLDocument doc; if (doc.LoadFile(itemDatabase.c_str()) != 0) { TRACE("Unable to open item database %s (%s)!", itemDatabase.c_str(), doc.GetErrorStr1()); throw std::runtime_error("Unable to open item database " + itemDatabase); } const XMLElement* root = doc.FirstChildElement("items"); for (const XMLElement* element = root->FirstChildElement(); element; element = element->NextSiblingElement()) { Item item = parse_item_element(element); TRACE("Loaded new item %s", item.name.c_str()); itemDefinitions.push_back(item); } }
void load_status_effects() { static const std::string database = config::res_path("StatusEffects.xml"); XMLDocument doc; if (doc.LoadFile(database.c_str()) != 0) { TRACE("Unable to open status database %s (%s)!", database.c_str(), doc.GetErrorStr1()); throw std::runtime_error("Unable to open status database " + database); } const XMLElement* root = doc.FirstChildElement("statusEffects"); for (const XMLElement* element = root->FirstChildElement(); element; element = element->NextSiblingElement()) { StatusEffect status = parse_status_effect_element(element); TRACE("New statusEffect %s loaded.", status.name.c_str()); statusEffects.push_back(status); } }
void load_config() { static const std::string conf = RESOURCE_DIR + "Config.xml"; TRACE("Loading config %s", conf.c_str()); XMLDocument doc; doc.LoadFile(conf.c_str()); const XMLElement* root = doc.FirstChildElement("config"); for (const XMLElement* element = root->FirstChildElement(); element; element = element->NextSiblingElement()) { std::string name = element->Name(); std::string value = element->GetText() ? element->GetText() : ""; if (value.size()) { TRACE(" - %s => %s", name.c_str(), value.c_str()); CONFIG[name] = value; } } }
/** * * Process information from an XML file * * */ const std::vector<LWSKernelPar> DividendTuningOptFileRoutines::getTuningPars(std::string fname) { XMLDocument doc; std::vector<LWSKernelPar> pars; XMLError err = doc.LoadFile(fname.c_str()); DIVIDEND_WARN_ON(err!= XML_NO_ERROR, "Failed to load file:%s", fname.c_str()); if (err != XML_NO_ERROR) return pars; XMLElement* root = doc.FirstChildElement("DIVIDEND")->FirstChildElement("LWGS"); DIVIDEND_EXIT_ERROR_ON(root == NULL, -1, "Failed to find LWGS"); const XMLElement *node = root->FirstChildElement(); while (node) { pars.push_back(processKernelElement(node)); node = node->NextSiblingElement(); } return pars; }
void Book::parseContainer(BLUnZip& zip) { std::string data = zip.ExtractToString("META-INF/container.xml"); XMLDocument doc; doc.Parse(data.c_str()); XMLElement* container = doc.FirstChildElement("container"); XMLElement* rootfiles = container->FirstChildElement("rootfiles"); XMLElement* rootfile = rootfiles->FirstChildElement("rootfile"); m_opf = rootfile->Attribute("full-path"); auto pos = m_opf.find("content.opf"); if (pos == 0) { m_container = ""; } else { m_container = m_opf.substr(0, pos); } }
void XmlReader::xmlReadTitleInfo(void) { XMLDocument doc; doc.LoadFile(m_filename); if (doc.ErrorID() != 0) { printf("read xml error!\n"); return; } XMLElement *root = doc.FirstChildElement("root"); XMLElement *dev_id = root->FirstChildElement("dev_id"); XMLElement *user_account = root->FirstChildElement("user_acount"); XMLElement *vsp_url = root->FirstChildElement("vsp_url"); XMLElement *code = root->FirstChildElement("code"); XMLElement *msg = root->FirstChildElement("msg"); printf("dev_id: %s\n", dev_id->GetText()); printf("user_account: %s\n", user_account->GetText()); printf("vsp_url: %s\n", vsp_url->GetText());; printf("code: %s\n", code->GetText()); printf("msg: %s\n", msg->GetText()); printf("============================================\n"); }
void Book::ParseOPF(BLUnZip& zipfile) { std::string unclean( zipfile.ExtractToString( opf ) ); XMLDocument doc; doc.Parse( unclean.c_str() ); XMLElement* package = doc.FirstChildElement("package"); XMLElement* manifest_ = package->FirstChildElement("manifest"); XMLElement* item = manifest_->FirstChildElement("item"); for(XMLElement* rfe = item; rfe != nullptr; rfe = rfe->NextSiblingElement("item")) { manifest.emplace(rfe->Attribute("id"), rfe->Attribute("href")); } XMLElement* spine_ = package->FirstChildElement("spine"); XMLElement* itemref = spine_->FirstChildElement("itemref"); for (XMLElement* rfe = itemref; rfe != nullptr; rfe = rfe->NextSiblingElement("itemref")) { spine.push_back(rfe->Attribute("idref")); } }