From fed1fcd1fe5e4f058d0eb204f990734076436dbb Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Thu, 8 Feb 2001 22:23:18 +0000 Subject: [PATCH] James LewisMoss's xml refactoring patch. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3625 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/Makefile.am | 1 + src/engine/gnc-xml-helper.h | 34 ++++++++++++++++++++++++++++++ src/engine/io-gncxml-r.c | 29 +------------------------ src/engine/io-gncxml-w.c | 29 +------------------------ src/engine/sixtp-to-dom-parser.c | 9 -------- src/engine/sixtp-writers.h | 29 +------------------------ src/engine/sixtp-xml-write-utils.c | 29 +------------------------ src/engine/sixtp-xml-write-utils.h | 29 +------------------------ src/engine/sixtp.h | 28 +----------------------- 9 files changed, 41 insertions(+), 176 deletions(-) create mode 100644 src/engine/gnc-xml-helper.h diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index 292e12bb20..5f699d51a7 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -79,6 +79,7 @@ noinst_HEADERS = \ gnc-event.h \ gnc-event-p.h \ gnc-numeric.h \ + gnc-xml-helper.h \ sixtp-parsers.h \ sixtp-writers.h \ sixtp-stack.h \ diff --git a/src/engine/gnc-xml-helper.h b/src/engine/gnc-xml-helper.h new file mode 100644 index 0000000000..d789974dc6 --- /dev/null +++ b/src/engine/gnc-xml-helper.h @@ -0,0 +1,34 @@ +#ifndef _GNC_XML_HELPER_H_ +#define _GNC_XML_HELPER_H_ + +#include "config.h" + +#ifdef HAVE_XML_VERSION_HEADER +#include +#endif + +#if defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 + +#include +#include +#include +#include +#ifndef xmlChildrenNode +#define xmlChildrenNode children +#define xmlRootNode children +#endif + +#else + +#include +#include +#include +#include +#ifndef xmlChildrenNode +#define xmlChildrenNode childs +#define xmlRootNode root +#endif + +#endif + +#endif /* _GNC_XML_HELPER_H_ */ diff --git a/src/engine/io-gncxml-r.c b/src/engine/io-gncxml-r.c index 83dcb923cb..d32416b470 100644 --- a/src/engine/io-gncxml-r.c +++ b/src/engine/io-gncxml-r.c @@ -13,34 +13,7 @@ #include -#ifdef HAVE_XML_VERSION_HEADER -#include -#endif - -#if defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#define xmlRootNode children -#endif - -#else - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode childs -#define xmlRootNode root -#endif - -#endif - +#include "gnc-xml-helper.h" #include "Account.h" #include "Query.h" #include "gnc-engine-util.h" diff --git a/src/engine/io-gncxml-w.c b/src/engine/io-gncxml-w.c index 1f6ba8582e..7f1b2d707a 100644 --- a/src/engine/io-gncxml-w.c +++ b/src/engine/io-gncxml-w.c @@ -49,34 +49,7 @@ #include #include -#ifdef HAVE_XML_VERSION_HEADER -#include -#endif - -#if defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#define xmlRootNode children -#endif - -#else - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode childs -#define xmlRootNode root -#endif - -#endif - +#include "gnc-xml-helper.h" #include "Account.h" #include "date.h" #include "DateUtils.h" diff --git a/src/engine/sixtp-to-dom-parser.c b/src/engine/sixtp-to-dom-parser.c index 406da47642..ab20904298 100644 --- a/src/engine/sixtp-to-dom-parser.c +++ b/src/engine/sixtp-to-dom-parser.c @@ -66,14 +66,6 @@ static gboolean dom_chars_handler( } -static gboolean dom_before_handler( - gpointer data_for_children, GSList* data_from_children, - GSList* sibling_data, gpointer parent_data, gpointer global_data, - gpointer *result, const gchar *tag, const gchar *child_tag) -{ - return TRUE; -} - sixtp* sixtp_dom_parser_new(sixtp_end_handler ender) { sixtp *top_level; @@ -83,7 +75,6 @@ sixtp* sixtp_dom_parser_new(sixtp_end_handler ender) if(!(top_level = sixtp_set_any(sixtp_new(), FALSE, SIXTP_START_HANDLER_ID, dom_start_handler, - SIXTP_BEFORE_CHILD_HANDLER_ID, dom_before_handler, SIXTP_CHARACTERS_HANDLER_ID, dom_chars_handler, SIXTP_END_HANDLER_ID, ender, SIXTP_NO_MORE_HANDLERS))) diff --git a/src/engine/sixtp-writers.h b/src/engine/sixtp-writers.h index bf42126675..8fdd7bdde4 100644 --- a/src/engine/sixtp-writers.h +++ b/src/engine/sixtp-writers.h @@ -6,34 +6,7 @@ #include -#ifdef HAVE_XML_VERSION_HEADER -#include -#endif - -#if defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#define xmlRootNode children -#endif - -#else - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode childs -#define xmlRootNode root -#endif - -#endif - +#include "gnc-xml-helper.h" #include "Query.h" gboolean xml_add_account_restorers(xmlNodePtr p, AccountGroup *g); diff --git a/src/engine/sixtp-xml-write-utils.c b/src/engine/sixtp-xml-write-utils.c index 967a4e6e9c..e4d6f47c67 100644 --- a/src/engine/sixtp-xml-write-utils.c +++ b/src/engine/sixtp-xml-write-utils.c @@ -8,34 +8,7 @@ #include #include -#ifdef HAVE_XML_VERSION_HEADER -#include -#endif - -#if defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#define xmlRootNode children -#endif - -#else - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode childs -#define xmlRootNode root -#endif - -#endif - +#include "gnc-xml-helper.h" #include "sixtp-xml-write-utils.h" #include "gnc-numeric.h" diff --git a/src/engine/sixtp-xml-write-utils.h b/src/engine/sixtp-xml-write-utils.h index e2391d262c..070cdf21e4 100644 --- a/src/engine/sixtp-xml-write-utils.h +++ b/src/engine/sixtp-xml-write-utils.h @@ -6,34 +6,7 @@ #include -#ifdef HAVE_XML_VERSION_HEADER -#include -#endif - -#if defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#define xmlRootNode children -#endif - -#else - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode childs -#define xmlRootNode root -#endif - -#endif - +#include "gnc-xml-helper.h" #include "gnc-numeric.h" #include "GNCId.h" #include "date.h" diff --git a/src/engine/sixtp.h b/src/engine/sixtp.h index b648c16d65..ba79718649 100644 --- a/src/engine/sixtp.h +++ b/src/engine/sixtp.h @@ -8,33 +8,7 @@ #include -#ifdef HAVE_XML_VERSION_HEADER -#include -#endif - -#if defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#define xmlRootNode children -#endif - -#else - -#include -#include -#include -#include -#ifndef xmlChildrenNode -#define xmlChildrenNode childs -#define xmlRootNode root -#endif - -#endif +#include "gnc-xml-helper.h" typedef struct _sixtp_child_result sixtp_child_result;