diff options
author | Johann Klähn <kljohann@gmail.com> | 2013-03-08 21:45:56 +0100 |
---|---|---|
committer | Johann Klähn <kljohann@gmail.com> | 2013-03-08 22:56:01 +0100 |
commit | a875940a93848d4b18b5bed45049edc901ad07a2 (patch) | |
tree | 33dcb08c5cb43ada33c4c4af9b11cb7c0bf6b3ef /src/xact.cc | |
parent | 8f4b0e89627b082f9c5d4bd2b506661aab732b0b (diff) | |
download | fork-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/xact.cc')
-rw-r--r-- | src/xact.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/xact.cc b/src/xact.cc index d33520b4..8aecf5d6 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -847,10 +847,8 @@ void auto_xact_t::extend_xact(xact_base_t& xact, parse_context_t& context) } } -void put_xact(property_tree::ptree& pt, const xact_t& xact) +void put_xact(property_tree::ptree& st, const xact_t& xact) { - property_tree::ptree& st(pt.put("transaction", "")); - if (xact.state() == item_t::CLEARED) st.put("<xmlattr>.state", "cleared"); else if (xact.state() == item_t::PENDING) @@ -859,14 +857,10 @@ void put_xact(property_tree::ptree& pt, const xact_t& xact) if (xact.has_flags(ITEM_GENERATED)) st.put("<xmlattr>.generated", "true"); - if (xact._date) { - property_tree::ptree& t(st.put("date", "")); - put_date(t, *xact._date, false); - } - if (xact._date_aux) { - property_tree::ptree& t(st.put("aux-date", "")); - put_date(t, *xact._date_aux, false); - } + if (xact._date) + put_date(st.put("date", ""), *xact._date); + if (xact._date_aux) + put_date(st.put("aux-date", ""), *xact._date_aux); if (xact.code) st.put("code", *xact.code); @@ -877,7 +871,7 @@ void put_xact(property_tree::ptree& pt, const xact_t& xact) st.put("note", *xact.note); if (xact.metadata) - put_metadata(st, *xact.metadata); + put_metadata(st.put("metadata", ""), *xact.metadata); } } // namespace ledger |