From 7c7e5c5e367778c6d54a1bb2be2db5c73db0492b Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 16 May 2007 05:38:32 +0000 Subject: Now using xpath_t::path_t to select nodes. --- src/main.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/main.cc') diff --git a/src/main.cc b/src/main.cc index 4fe41be2..db34f183 100644 --- a/src/main.cc +++ b/src/main.cc @@ -268,9 +268,17 @@ static int read_and_report(ledger::report_t * report, int argc, char * argv[], xpath.print(*out, xml_document); *out << std::endl; - foreach (xml::node_t * node, xpath.find_all(xml_document, report)) { - node->print(std::cout); - std::cout << std::endl; + value_t result = xpath.calc(xml_document, report); + + if (result.is_sequence()) { + foreach (const value_t& value, result.as_sequence()) { + if (value.is_xml_node()) { + value.as_xml_node()->print(std::cout); + std::cout << std::endl; + } + } + } else { + std::cout << result << std::endl; } return 0; } -- cgit v1.2.3