From 687ee1a7c34f7484b715ac6d88b84a980247f6ac Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 14 May 2007 11:09:35 +0000 Subject: document_builder_t is now working. --- src/node.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/node.cc') diff --git a/src/node.cc b/src/node.cc index 390ef988..f19b5989 100644 --- a/src/node.cc +++ b/src/node.cc @@ -60,17 +60,22 @@ void output_xml_string(std::ostream& out, const string& str) } } -void parent_node_t::print(std::ostream& out) const +void node_t::print_attributes(std::ostream& out) const { - out << '<' << name(); if (attributes) { typedef attributes_t::nth_index<0>::type attributes_by_order; foreach (const attr_pair& attr, attributes->get<0>()) - out << ' ' << document().lookup_name(attr.first) + out << ' ' << *document().lookup_name(attr.first) << "=\"" << attr.second << "\""; } IF_VERIFY() out << " type=\"parent_node_t\""; +} + +void parent_node_t::print(std::ostream& out) const +{ + out << '<' << name(); + print_attributes(out); out << '>'; foreach (node_t * child, *this) @@ -83,13 +88,11 @@ void terminal_node_t::print(std::ostream& out) const { if (data.empty()) { out << '<' << name(); - IF_VERIFY() - out << " type=\"terminal_node_t\""; + print_attributes(out); out << " />"; } else { out << '<' << name(); - IF_VERIFY() - out << " type=\"terminal_node_t\""; + print_attributes(out); out << '>'; output_xml_string(out, text()); out << "'; -- cgit v1.2.3