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.

Defines

#define QOF_MOD_QSF   "qof-backend-qsf"

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 1110 of file qsf-backend.c.

01111 {
01112         QSFBackend *qsf_be;
01113         QofBackend *be;
01114         
01115         qsf_be = g_new0(QSFBackend, 1);
01116         be = (QofBackend*) qsf_be;
01117         qof_backend_init(be);
01118         qsf_be->params = g_new(qsf_param, 1);
01119         qsf_be->params->be = be;
01120         qsf_param_init(qsf_be->params);
01121         qsf_be->be.session_begin = qsf_session_begin;
01122 
01123         be->session_end = qsf_session_end;
01124         be->destroy_backend = qsf_destroy_backend;
01125         be->load = qsf_file_type;
01126         be->save_may_clobber_data = NULL;
01127         /* The QSF backend will always load and save the entire QSF XML file. */
01128         be->begin = NULL;
01129         be->commit = NULL;
01130         be->rollback = NULL;
01131         /* QSF uses the built-in SQL, not a dedicated SQL server. */
01132         be->compile_query = NULL;
01133         be->free_query = NULL;
01134         be->run_query = NULL;
01135         be->counter = NULL;
01136         /* The QSF backend is not multi-user. */
01137         be->events_pending = NULL;
01138         be->process_events = NULL;
01139         
01140         be->sync = qsf_write_file;
01141         /* use for maps, later. */
01142         be->load_config = qsf_load_config;
01143         be->get_config = qsf_get_config;
01144 
01145         qsf_be->fullpath = NULL;
01146         return be;
01147 }

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 1165 of file qsf-backend.c.

01166 {
01167         QofBackendProvider *prov;
01168 
01169         #ifdef ENABLE_NLS
01170         setlocale (LC_ALL, "");
01171         bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
01172         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
01173         textdomain (GETTEXT_PACKAGE);
01174         #endif
01175         prov = g_new0 (QofBackendProvider, 1);
01176         prov->provider_name = "QSF Backend Version 0.1";
01177         prov->access_method = "file";
01178         prov->partial_book_supported = TRUE;
01179         prov->backend_new = qsf_backend_new;
01180         prov->check_data_type = qsf_determine_file_type;
01181         prov->provider_free = qsf_provider_free;
01182         qof_backend_register_provider (prov);
01183 }


Generated on Fri Oct 21 15:50:00 2005 for QOF by  doxygen 1.4.5