QOF Serialisation Format
[Backend]


Detailed Description

This is the public interface of the qof-backend-qsf library.

QSF - QOF Serialization Format is an XML serialization format i.e. it lays out a QOF object in a series of XML tags. The format will consist of two component formats:

qof-qsf for the QSF object data and

qsf-map to map sets of QSF objects between QOF applications.

Maps exist to allow complex conversions between objects where object parameters need to be calculated, combined or processed using conditionals. Some QSF objects can be converted using XSL or other standard tools. For more information on maps, see http://code.neil.williamsleesmill.me.uk/map.html

QSF object files will contain user data and are to be exported from QOF applications under user control or they can be hand-edited. QSF maps contain application data and can be created by application developers from application source code. Tools may be created later to generate maps interactively but maps require application support as well as an understanding of QOF objects in the import and output applications and are intended to remain within the scope of application developers rather than users.

A QSF file written by one QOF application will need an appropriate QSF map before the data can be accessed by a different application using QOF. Any QSF objects that are not defined in the map will be ignored. QSF files written and accessed by the same application can use maps if necessary or can simply import the QSF data as a whole.

Unless specifically mentioned otherwise, all defined strings are case-sensitive.

Full documentation of this format is at:

http://code.neil.williamsleesmill.me.uk/qsf.html

QSF itself is now being built into the QOF library for use with pilot-link to allow Palm objects to be described in QOF, written to XML as QSF and imported directly into GnuCash and other QOF-compliant applications. As a generic format, it does not depend on any pre-defined objects - as the current GnuCash XML format depends on AccountGroup. Instead, QSF is a simple container for all QOF objects.

QSF grew from the qof_book_merge code base and uses the qof_book_merge code that is now part of QOF. Any QofBook generated by QSF still needs to be merged into the existing application data using qof_book_merge. See BookMerge.

QSF can be used as an export or offline storage format for QOF applications (although long term storage may be best performed using separate (non-XML) methods, depending on the application).

QSF is designed to cope with partial QofBooks at the QofObject level. There is no requirement for specific objects to always be defined, as long as each QOF object specified is fully defined, no orphan or missing parameters are allowed. Part of the handling for partial books requires a storage mechanism for references to entities that are not within reach of the current book. This requires a little extra coding in the QSF QofBackend to contain the reference data so that when the book is written out, the reference can be included. When the file is imported back in, a little extra code then rebuilds those references during the merge.

Copying entites from an existing QofBook using the qof_entity_copy routines will automatically create the reference table. If your QOF objects use references to other entities, books that are created manually also need to create a reference table.

Work is continuing on supporting QSF in GnuCash and QOF. QSF is a very open format - the majority of the work will be in standardising object types and creating maps that convert between objects. Applications that read QSF should ignore any objects that do not match the available maps and warn the user about missing data.

Anyone is free to create their own QSF objects, subject to the GNU GPL. It is intended that QSF can be used as the flexible, open and free format for QOF data - providing all that is lacking from a typical CSV export with all the validation benefits of XML and the complex data handling of QOF. The QSF object and map formats remain under the GNU GPL licence and QSF is free software.

Todo:
Todo:
QOF contains numerous g_string_sprintf and g_string_sprintfa calls. These are deprecated and should be renamed to g_string_printf and g_string_append_printf respectively.
QSF is in three sections:


Files

file  qof-backend-qsf.h
 QSF API - Backend, maps and objects.

Functions

void qsf_provider_init (void)
 Describe this backend to the application.
QofBackendqsf_backend_new (void)
 Create a new QSF backend.


Function Documentation

QofBackend* qsf_backend_new void   ) 
 

Create a new QSF backend.

Initialises the backend and provides access to the functions that will load and save the data.

Definition at line 1080 of file qsf-backend.c.

01081 {
01082         QSFBackend *qsf_be;
01083         QofBackend *be;
01084 
01085         qsf_be = g_new0(QSFBackend, 1);
01086         be = (QofBackend*) qsf_be;
01087         qof_backend_init(be);
01088         qsf_be->params = g_new(qsf_param, 1);
01089         qsf_be->params->be = be;
01090         qsf_param_init(qsf_be->params);
01091         qsf_be->be.session_begin = qsf_session_begin;
01092 
01093         be->session_end = qsf_session_end;
01094         be->destroy_backend = qsf_destroy_backend;
01095         be->load = qsf_file_type;
01096         be->save_may_clobber_data = NULL;
01097         /* The QSF backend will always load and save the entire QSF XML file. */
01098         be->begin = NULL;
01099         be->commit = NULL;
01100         be->rollback = NULL;
01101         /* QSF uses the built-in SQL, not a dedicated SQL server. */
01102         be->compile_query = NULL;
01103         be->free_query = NULL;
01104         be->run_query = NULL;
01105         be->counter = NULL;
01106         /* The QSF backend is not multi-user. */
01107         be->events_pending = NULL;
01108         be->process_events = NULL;
01109 
01110         be->sync = qsf_write_file;
01111         /* use for maps, later. */
01112         be->load_config = qsf_load_config;
01113         be->get_config = qsf_get_config;
01114 
01115         qsf_be->fullpath = NULL;
01116         return be;
01117 }

void qsf_provider_init void   ) 
 

Describe this backend to the application.

Sets QSF Backend Version 0.1, access method = file:

This is the QOF backend interface, not a GnuCash module.

Definition at line 1135 of file qsf-backend.c.

01136 {
01137         #ifdef ENABLE_NLS
01138         setlocale (LC_ALL, "");
01139         bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
01140         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
01141         textdomain (GETTEXT_PACKAGE);
01142         #endif
01143         QofBackendProvider *prov;
01144         prov = g_new0 (QofBackendProvider, 1);
01145         prov->provider_name = "QSF Backend Version 0.1";
01146         prov->access_method = "file";
01147         prov->partial_book_supported = TRUE;
01148         prov->backend_new = qsf_backend_new;
01149         prov->check_data_type = qsf_determine_file_type;
01150         prov->provider_config = "qsf-backend-v0.1.xml";
01151         prov->provider_free = qsf_provider_free;
01152         qof_backend_register_provider (prov);
01153 }


Generated on Sun Sep 4 18:09:07 2005 for GnuCash by  doxygen 1.4.3-20050530