#include "XML.hpp" namespace ousia { namespace xml { void Node::serialize(std::ostream& out){ out << "\n"; doSerialize(out, 0); } void Element::doSerialize(std::ostream& out, unsigned int tabdepth) { for (unsigned int t = 0; t < tabdepth; t++) { out << '\t'; } out << '<' << name; for (auto &a : attributes) { out << ' ' << a.first << "=\"" << a.second << '\"'; } out << ">\n"; for (auto &n : children) { n->doSerialize(out, tabdepth + 1); } for (unsigned int t = 0; t < tabdepth; t++) { out << '\t'; } out << "\n"; } void Text::doSerialize(std::ostream& out, unsigned int tabdepth) { for (unsigned int t = 0; t < tabdepth; t++) { out << '\t'; } out << text << '\n'; } } }