summaryrefslogtreecommitdiff
path: root/src/ptree.cc
diff options
context:
space:
mode:
authorJohann Klähn <kljohann@gmail.com>2013-03-08 21:45:56 +0100
committerJohann Klähn <kljohann@gmail.com>2013-03-08 22:56:01 +0100
commita875940a93848d4b18b5bed45049edc901ad07a2 (patch)
tree33dcb08c5cb43ada33c4c4af9b11cb7c0bf6b3ef /src/ptree.cc
parent8f4b0e89627b082f9c5d4bd2b506661aab732b0b (diff)
downloadfork-ledger-a875940a93848d4b18b5bed45049edc901ad07a2.tar.gz
fork-ledger-a875940a93848d4b18b5bed45049edc901ad07a2.tar.bz2
fork-ledger-a875940a93848d4b18b5bed45049edc901ad07a2.zip
fix ledger xml output, remove ledger json command
As the format used by property trees to represent valid JSON and that for valid XML is too different and given that there are more requests for valid XML output I decided to pursue a quick fix and remove the json command in favor of a working xml command. See bug #782, #909, recent discussion on mailing list. JSON support is postponed until I or someone else finds time to work on this or the python bindings are more stable.
Diffstat (limited to 'src/ptree.cc')
-rw-r--r--src/ptree.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ptree.cc b/src/ptree.cc
index 1e271465..1d2d4b26 100644
--- a/src/ptree.cc
+++ b/src/ptree.cc
@@ -61,28 +61,27 @@ 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);
+ out << std::endl;
break;
}
}