GnuCash XML spec

John Ralls jralls at ceridwen.us
Thu Nov 1 12:33:17 EDT 2012


On Nov 1, 2012, at 8:23 AM, Ngewi Fet <ngewif at gmail.com> wrote:

> 
> 
> On Thu, Nov 1, 2012 at 4:12 PM, Derek Atkins <warlord at mit.edu> wrote:
> John Ralls <jralls at ceridwen.us> writes:
> 
> > Ngewi,
> >
> > You can use Trang (http://www.thaiopensource.com/relaxng/trang.html) to convert an RNG schema to XSD.
> >
> 
> Thanks John, I'll check out the converter or just try to figure out RNG
>  
> > Gnucash-v2.rnc was contributed only a few months ago, so it's current. Whether or not it's complete or correct is another matter.
> 
> Note also that the rnc/xsd is NOT canonical..  It is informative only,
> and might change at any time.  GnuCash uses hand-build
> generators/parsers and does not use any schema files itself.  So YMMV.
> 
> 
> If I understand right, this means that only what is implemented in GnuCash is the current spec? No other documentation cannot be relied upon to be factual?
> 
> Also, what is the policy of GnuCash towards manipulating the XML. Because I remember that for the database, I once read something like "We do not support modifications to the database from outside the GnuCash 
> API. ". http://gnucash.1415818.n4.nabble.com/queries-on-mysql-tp3053682p3053871.html
> 
> Is modifying the XML also actively discouraged?

Pretty much. There's a lot of "business logic" in engine that enforces things like balanced transactions, and users editing the XML directly can have the same dire effects as users writing directly to SQL. The qualification is that the SQL DB is more-or-less normalized, so the bits of a transaction are splattered over several tables, which a transaction and its splits are kept together in a single element, so it's easier for a human to examine in XML and see if it's balanced or not. That won't help with accounts or securities/currencies, which are referenced by GUID.

We are explicit about that with SQL because we've seen a lot of users say that they want to use a SQL backend expressly to write their own import routines. On the other hand, there are some repair actions for which there is no specific API, never mind GUI. One example which came up recently was a fellow who wanted to clean out old transaction-import matching rules. The only API for that is the generic KVP stuff, so the only reasonable way is to edit the XML storage of those rules. That could be done in SQL, of course, but the KVP storage in SQL is binary-relational and you'd make yourself crazy trying to follow it by hand.

Regards,
John Ralls


More information about the gnucash-devel mailing list