XML file backend

Derek Atkins warlord at MIT.EDU
Tue Jun 10 09:59:30 EDT 2008


Phil Longstaff <plongstaff at rogers.com> writes:

> The xml file backend has 2 functions to handle a commodity reference.  The first, dom_tree_to_commodity_ref_no_engine(), gets the two pieces of the reference (space and id) and creates a new gnc_commodity from them.  The second, dom_tree_to_commodity_ref(), calls dom_tree_to_commodity_ref_no_engine() and then looks up the commodity in the engine.  This has the result of only leaving 1 gnc_commodity per commodity.

Right, you only WANT 1 gnc_commodity* object per commodity.  That's
exactly what you want.  Similarly you only want one Account* object
per account, one Transaction* object per transaction, etc.

> In the places where commodity refs are used, dom parsers for prices and transactions call dom_tree_to_commodity_ref() but the parser for accounts calls dom_tree_to_commodity_ref_no_engine().  Can anyone explain why?

Probably because Accounts are always loaded first so you'll always have
all your commodities before you load any transactions.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list