Jim Easter <[EMAIL PROTECTED]> writes:

> 4) There are many ways to innocently corrupt a gnucash .xac file so
> that the application cannot read it and crashes on the attempt.  The
> .xac file is not ASCII, nor is it readable (and thus repairable) by
> any other application I know.  If a script or extension made it
> possible to read and recover the file, I would then feel that I
> could enter a bunch of data without fear of losing it.
> Additionally, I could then export and import files from, e.g.,
> gnumeric.  Am I missing something -- is there a built-in way to
> export or import between .xac and some neutral file format?  Has
> anyone out there written a plug-in?

In the current CVS tree, I have some code that you can call from the
extensions menu that'll spit out a gnucash file as text in a format
that it would be trivial to write a parser for (though it hasn't been
done yet) [1].  The data is written out as scheme forms that are
guaranteed to have all the data (strings, etc.) properly escaped so
that sucking it back in later is just a matter of using scheme's
reader in conjunction with a *very* simple loop.

It hasn't been heavily tested or reviewed, but getting aroung to
writing the parser and making this format available at least via an
import/export menu item should be on our to-do list.

At the very least, as soon as we fix the code to ask for a file name
and then save to that file, rather than spewing to standard output,
you should have a way to get your data archived in a reasonably
straightforward (i.e. text) format.

Using scheme forms means that writing a translator to any other text
format (XML, SGML, Gnumeric?, whatever) is a trivial exercise, and if
you're not too worried about safety, this can be done with almost no
code using scheme functions rather than a parser.  This would be
acceptable for end-user throwaway scripts, but for GnuCash itself,
we'll need a safer, more restrictive, though still trivial parser.

[1] Actually I just noticed that the code is broken.  One of us (me?)
took out gnc_main_window_get_session without modifying the code on the
scheme side to use whatever replaced it.  I'll have to look in to
that.

-- 
Rob Browning <[EMAIL PROTECTED]> PGP=E80E0D04F521A094 532B97F5D64E3930
----- %< -------------------------------------------- >% ------
The GnuCash / X-Accountant Mailing List
To unsubscribe, send mail to [EMAIL PROTECTED] and
put "unsubscribe gnucash-devel [EMAIL PROTECTED]" in the body

Reply via email to