summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-16 05:38:32 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:52 -0400
commit7c7e5c5e367778c6d54a1bb2be2db5c73db0492b (patch)
tree16ed5bde7719aa10b4d7cde25eaaf2ea64fa7f80 /src/main.cc
parent74ecceb2ba0cb1592f570bcb52619f882c15bd27 (diff)
downloadfork-ledger-7c7e5c5e367778c6d54a1bb2be2db5c73db0492b.tar.gz
fork-ledger-7c7e5c5e367778c6d54a1bb2be2db5c73db0492b.tar.bz2
fork-ledger-7c7e5c5e367778c6d54a1bb2be2db5c73db0492b.zip
Now using xpath_t::path_t to select nodes.
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc14
1 files changed, 11 insertions, 3 deletions
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;
}