GnuCash 2.4.99
Functions
io-gncxml.h File Reference

api for Version 1 XML-based file format More...

#include <glib.h>
#include "qof.h"

Go to the source code of this file.

Functions

gboolean qof_session_load_from_xml_file (QofBook *, const char *filename)
gboolean gnc_is_xml_data_file (const gchar *name)

Detailed Description

api for Version 1 XML-based file format

Initial code by Rob L. Browning 4Q 2000 Tuneups by James LewisMoss Dec 2000

Definition in file io-gncxml.h.


Function Documentation

gboolean gnc_is_xml_data_file ( const gchar *  name)

The is_gncxml_file() routine checks to see if the first few chars of the file look like gnc-xml data.

Definition at line 413 of file io-gncxml-v1.c.

{
    if ((gnc_is_our_xml_file(filename, NULL)) == GNC_BOOK_XML1_FILE)
        return TRUE;
    return FALSE;
}
gboolean qof_session_load_from_xml_file ( QofBook ,
const char *  filename 
)

Read in an account group from a file

Definition at line 364 of file io-gncxml-v1.c.

{
    gboolean parse_ok;
    gpointer parse_result = NULL;
    sixtp *top_level_pr;
    GNCParseStatus global_parse_status;
    Account *root;

    global_parse_status.book = book;
    g_return_val_if_fail(book, FALSE);
    g_return_val_if_fail(filename, FALSE);

    xaccDisableDataScrubbing();
    top_level_pr = gncxml_setup_for_read (&global_parse_status);
    g_return_val_if_fail(top_level_pr, FALSE);

    parse_ok = sixtp_parse_file(top_level_pr,
                                filename,
                                NULL,
                                &global_parse_status,
                                &parse_result);

    sixtp_destroy(top_level_pr);
    xaccEnableDataScrubbing();

    if (parse_ok)
    {
        if (!global_parse_status.root_account) return FALSE;

        root = global_parse_status.root_account;
        gnc_book_set_root_account(book, root);

        /* Fix account and transaction commodities */
        xaccAccountTreeScrubCommodities (root);

        /* Fix split amount/value */
        xaccAccountTreeScrubSplits (root);

        return(TRUE);
    }
    else
    {
        return(FALSE);
    }
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines