Comments, Observations, and some XML file format questions

Paul Lussier pll@mclinux.com
Mon, 27 Aug 2001 09:15:02 -0400


Hi all,

I was playing around with GnuCash last night (1.6.1, on Debian/Sid).  
One of the things I was doing was starting a new file for the 
year 2001 (I haven't quite finished up with 2000 yet, but wanted to 
get this stuff in without possibly screwing things up :)

Anyway, I quickly discovered the "Export Accounts List" feature.  
That worked perfectly, great idea, great job!!

Comments/Observations:

However, there's nothing I could find in the docs about how to import 
such an exported file to begin a new GnuCash file.  It obviously is 
as easy as "File->Open"ing the exported file and then saving it as a 
new GnuCash file, but it might be nice to mention that in the docs 
somewhere (come to think of it, I don't remember even seeing the 
export feature mentioned there).

Once I opened this new file with my old chart of accounts, I was 
disappointed to see that wrt my other file's memorized transactions, 
GnuCash apparently had amnesia :(  After thinking about this, it made 
perfect sense, however, when I opened my old file, highlighted the 
particular transaction I was trying to add in the new file, and 
selected "Edit->Copy Transaction", then switched back to the new 
file, "Edit->Paste Transaction" did nothing.  This was mildly 
annoying.  I don't know if that is expected behavior or not, but it's 
definitely not what I expected.

So, to summarize this situation, I would ask/suggest for 2 
enhancements for the future:

	1.  Fix the Copy/Paste Transaction utility such that a 
	    transaction from one file can be copied to another

	2.  Create some kind of cache file which keeps track of 
	    at least payees and maybe the structure of the
	    transaction. (probably easier to keep just a cache
	    of payees, which would suffice for most I think).


XML file format questions:

What is the structure of the XML file format?  By that, I mean is 
there any order to the file itself, or does GnuCash determine the 
order of the file as it's read in?

The reason behind my question is this.  I want to write some 
(perl-based) command-line utilities to manipulate the file to do 
things like add/clone transactions, but I need to know how to access 
some of the existing transactions.  One thing which would help make 
my life easy would be if there were transaction identifiers of some 
kind.  Something like a unique number assigned for each transaction 
within an account, even if it began at 0 and sequentially increased.

For example, every Wednesday, I stop for breakfast on the way to work 
at the same place and pretty much always order the same thing.  
Therefore, each Wednesday, I spend the same amount on breakfast.
Since there's already a transaction in my "Assets:Cash" account, I'd 
like to be able to do something like:

	> gncdup --account Assets:Cash --orig-trans 1504 --new-date 2001-08-27

Which would take tranaction 1504 from the Assets:Cash account, and 
clone it, but with a new date of today.  Obviously in order to do 
this though, there needs to be some transaction identifier to key in 
on.

Also along this idea, I'd have some kind of command line utility 
which would allow me to browse any given account in order to find
the most recent transaction.  I guess what I'm driving at here, is I 
want to create a set of command line utilities for GnuCash similar to 
the way the 'mh' mail system handles mail.  In order to do that I 
need to know a little more about the structure of the XML file.

I have looked at it a little bit, but I'd rather get an explanation 
for those of you who designed the format before I dive in and make a 
bunch of (possibly) wrong assumptions :)

Thanks!


-- 

Seeya,
Paul
----
	...we don't need to be perfect to be the best around,
		and we never stop trying to be better. 
		       Tom Clancy, The Bear and The Dragon

	 If you're not having fun, you're not doing it right!