rendered paste body#include <fstream>#include <iostream>#include <sstream>#include "pugixml.hpp"#include "TemplateReader.hpp"TemplateReader::TemplateReader () {}TemplateReader::~TemplateReader () {}void TemplateReader::DoFileRead (const std::string &file, TemplateManager *manager) { std::ifstream in (file, std::ios::in); // xml library seems to be bugged, read file into memory std::stringstream ss; ss << in.rdbuf(); pugi::xml_document document; pugi::xml_parse_result result = document.load (ss.str().c_str()); pugi::xml_node templates = document.child ("template"); for (pugi::xml_node_iterator itr = templates.begin(); itr != templates.end(); ++itr) { //std::cout << "<" << itr->name() << " " << itr->attribute("value").name() << " = " << itr->attribute("value").value() << "/>" << std::endl; if (strcmp (itr->name(), "doc") == 0) { std::string doc_tag (itr->name()); std::string doc_value (itr->attribute ("value").value()); std::cout << "doc = " << doc_value << std::endl; } else if (strcmp (itr->name(), "mind") == 0) { for (pugi::xml_attribute_iterator atr = itr->attributes_begin(); atr != itr->attributes_end(); ++atr) { // Component::SetValue (field, value) map? std::cout << atr->name() << ":" << atr->value() << std::endl; } } }}