## GnomeDbXmlStorage

GnomeDbXmlStorage — Interface which provides saving and loading using XML structures

## Synopsis

                GnomeDbXmlStorage;
                GnomeDbXmlStorageIface;
    GType       gnome_db_xml_storage_get_type   (void);
    gchar*      gnome_db_xml_storage_get_xml_id (GnomeDbXmlStorage *iface);
    xmlNodePtr  gnome_db_xml_storage_save_to_xml
                                                (GnomeDbXmlStorage *iface,
                                                 GError **error);
    gboolean    gnome_db_xml_storage_load_from_xml
                                                (GnomeDbXmlStorage *iface,
                                                 xmlNodePtr node,
                                                 GError **error);

## Object Hierarchy

      GInterface
       +----GnomeDbXmlStorage

## Prerequisites

GnomeDbXmlStorage requires GObject.

## Known Implementations

GnomeDbXmlStorage is implemented by GnomeDbTable, GnomeDbGraph, GnomeDbQfAll, GnomeDbQfValue, GnomeDbTarget, GnomeDbQuery, GnomeDbServer, GnomeDbDatabase, GnomeDbCondition, GnomeDbConstraint, GnomeDbQfFunc, GnomeDbServerDataType, GnomeDbServerFunction, GnomeDbGraphItem, GnomeDbGraphQuery, GnomeDbServerAggregate, GnomeDbQfAgg, GnomeDbTableField, GnomeDbJoin and GnomeDbQfField.

## Description

Any object which implements this interface can be streamed and restored to and from an XML file.

## Details

### GnomeDbXmlStorage

    typedef struct _GnomeDbXmlStorage GnomeDbXmlStorage;

### GnomeDbXmlStorageIface

    typedef struct {
    	GTypeInterface           g_iface;

    	/* virtual table */
    	gchar      *(* get_xml_id)      (GnomeDbXmlStorage *iface);
    	xmlNodePtr  (* save_to_xml)     (GnomeDbXmlStorage *iface, GError **error);
    	gboolean    (* load_from_xml)   (GnomeDbXmlStorage *iface, xmlNodePtr node, GError **error);
    } GnomeDbXmlStorageIface;

### gnome_db_xml_storage_get_type ()

    GType       gnome_db_xml_storage_get_type   (void);

Returns : |

### gnome_db_xml_storage_get_xml_id ()

    gchar*      gnome_db_xml_storage_get_xml_id (GnomeDbXmlStorage *iface);

Fetch the xml id string of the object, it's up to the caller to free the string.

`iface` : | an object which implements the GnomeDbXmlStorage interface
Returns : | the xml id.

### gnome_db_xml_storage_save_to_xml ()

    xmlNodePtr  gnome_db_xml_storage_save_to_xml
                                                (GnomeDbXmlStorage *iface,
                                                 GError **error);

Creates a new xmlNodePtr structure and fills it with data representing the object given as argument.

`iface` : | an object which implements the GnomeDbXmlStorage interface
`error` : | location to store error, or `NULL`
Returns : | the new XML node, or NULL if an error occurred.

### gnome_db_xml_storage_load_from_xml ()

    gboolean    gnome_db_xml_storage_load_from_xml
                                                (GnomeDbXmlStorage *iface,
                                                 xmlNodePtr node,
                                                 GError **error);

Updates the object with data stored in the XML node. The object MUST already exist and be of the correct type before calling this function. This is a virtual function.

`iface` : | an object which implements the GnomeDbXmlStorage interface
`node` : | an XML node from an XML structure
`error` : | location to store error, or `NULL`
Returns : | TRUE if no error occurred.