ledger/register.cc
John Wiegley 0a6b5726ec Made the amount/balance/value interface a bit more rational; added
back a useless version of the register command (just to prove the
 command sequence); and added smart XML semantics to the XPath
 implementation so that nodes can be coerced to values.
2008-04-13 03:38:28 -04:00

31 lines
746 B
C++

#include "register.h"
#include "journal.h"
namespace ledger {
void register_command::print_document(std::ostream& out,
xml::document_t * doc)
{
value_t nodelist = xml::xpath_t::eval("//transaction", doc);
value_t::sequence_t * xact_list = nodelist.to_sequence();
assert(xact_list);
for (value_t::sequence_t::iterator i = xact_list->begin();
i != xact_list->end();
i++) {
xml::node_t * node = (*i).to_xml_node();
assert(node);
xml::transaction_node_t * xact_node =
dynamic_cast<xml::transaction_node_t *>(node);
assert(xact_node);
transaction_t * xact = xact_node->transaction;
assert(xact);
std::cout << xact->account->fullname() << std::endl;
}
}
} // namespace ledger