diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-15 05:43:46 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:51 -0400 |
commit | 3244c693f8db9afb1845f5e6de3cb1807e68003d (patch) | |
tree | 1ee7e4ef2d8119989b346b2cdae4d7a834214b1b /src/main.cc | |
parent | 9e55655e0c1a56d3059bd8fc485e37fc3333b3bb (diff) | |
download | fork-ledger-3244c693f8db9afb1845f5e6de3cb1807e68003d.tar.gz fork-ledger-3244c693f8db9afb1845f5e6de3cb1807e68003d.tar.bz2 fork-ledger-3244c693f8db9afb1845f5e6de3cb1807e68003d.zip |
Started working on an XPath visitor class
Diffstat (limited to 'src/main.cc')
-rw-r--r-- | src/main.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main.cc b/src/main.cc index 7aea3c2c..669afefb 100644 --- a/src/main.cc +++ b/src/main.cc @@ -46,6 +46,10 @@ #include <fdstream.hpp> #endif +void print_node(ledger::xml::node_t& node) { + node.print(std::cout); +} + static int read_and_report(ledger::report_t * report, int argc, char * argv[], char * envp[]) { @@ -269,12 +273,28 @@ static int read_and_report(ledger::report_t * report, int argc, char * argv[], xpath.print(*out, xml_document); *out << std::endl; +#if 1 + try { + xml::xpath_t::path_t path_selection(xpath); + + xml::xpath_t::path_t::element_t elem; + elem.ident = xml::document_t::ROOT; + path_selection.elements.push_back(elem); + elem.ident = xml::TRANSACTION_NODE; + elem.recurse = true; + path_selection.elements.push_back(elem); + path_selection.visit(xml_document, report, bind(print_node, _1)); + } + catch (...) { + throw; + } +#else value_t nodelist; xpath.calc(nodelist, xml_document, report); foreach (const value_t& node, nodelist.as_sequence()) node.as_xml_node()->print(*out); - +#endif return 0; } |