GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 389 of file io-gncxml-v1.c.

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

Read in an account group from a file

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

341 {
342  gboolean parse_ok;
343  gpointer parse_result = NULL;
344  sixtp *top_level_pr;
345  GNCParseStatus global_parse_status;
346  Account *root;
347 
348  global_parse_status.book = book;
349  g_return_val_if_fail(book, FALSE);
350  g_return_val_if_fail(filename, FALSE);
351 
352  xaccDisableDataScrubbing();
353  top_level_pr = gncxml_setup_for_read (&global_parse_status);
354  g_return_val_if_fail(top_level_pr, FALSE);
355 
356  parse_ok = sixtp_parse_file(top_level_pr,
357  filename,
358  NULL,
359  &global_parse_status,
360  &parse_result);
361 
362  sixtp_destroy(top_level_pr);
363  xaccEnableDataScrubbing();
364 
365  if (parse_ok)
366  {
367  if (!global_parse_status.root_account) return FALSE;
368 
369  root = global_parse_status.root_account;
370  gnc_book_set_root_account(book, root);
371 
372  /* Fix account and transaction commodities */
374 
375  /* Fix split amount/value */
376  xaccAccountTreeScrubSplits (root);
377 
378  return(TRUE);
379  }
380  else
381  {
382  return(FALSE);
383  }
384 }
Definition: sixtp.h:93
void xaccAccountTreeScrubCommodities(Account *acc)
Definition: Scrub.c:1174