GnuCash c935c2f+
Loading...
Searching...
No Matches
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)
 Read in an account group from a file.
 
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.
 

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

◆ gnc_is_xml_data_file()

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 391 of file io-gncxml-v1.cpp.

392{
393 if ((gnc_is_our_xml_file (filename, NULL)) == GNC_BOOK_XML1_FILE)
394 return TRUE;
395 return FALSE;
396}

◆ qof_session_load_from_xml_file()

gboolean qof_session_load_from_xml_file ( QofBook book,
const char *  filename 
)

Read in an account group from a file.

Definition at line 342 of file io-gncxml-v1.cpp.

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