summaryrefslogtreecommitdiff
path: root/src/ptree.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ptree.cc')
-rw-r--r--src/ptree.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ptree.cc b/src/ptree.cc
index 6fb840e0..e7afdcd1 100644
--- a/src/ptree.cc
+++ b/src/ptree.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2012, John Wiegley. All rights reserved.
+ * Copyright (c) 2003-2013, John Wiegley. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -61,28 +61,28 @@ void format_ptree::flush()
property_tree::ptree& ct(pt.put("ledger.commodities", ""));
foreach (const commodities_pair& pair, commodities)
- put_commodity(ct, *pair.second, true);
+ put_commodity(ct.add("commodity", ""), *pair.second, true);
property_tree::ptree& at(pt.put("ledger.accounts", ""));
- put_account(at, *report.session.journal->master, account_visited_p);
+ put_account(at.add("account", ""), *report.session.journal->master, account_visited_p);
property_tree::ptree& tt(pt.put("ledger.transactions", ""));
foreach (const xact_t * xact, transactions) {
- put_xact(tt, *xact);
+ property_tree::ptree& t(tt.add("transaction", ""));
+ put_xact(t, *xact);
- property_tree::ptree& post_tree(tt.put("postings", ""));
+ property_tree::ptree& post_tree(t.put("postings", ""));
foreach (const post_t * post, xact->posts)
if (post->has_xdata() &&
post->xdata().has_flags(POST_EXT_VISITED))
- put_post(post_tree, *post);
+ put_post(post_tree.add("posting", ""), *post);
}
switch (format) {
case FORMAT_XML:
- property_tree::write_xml(out, pt);
- break;
- case FORMAT_JSON:
- property_tree::write_json(out, pt);
+ property_tree::xml_writer_settings<char> indented(' ', 2);
+ property_tree::write_xml(out, pt, indented);
+ out << std::endl;
break;
}
}