From dcf55d0a40c0ebb1ca38e3a01617636f5f5df55b Mon Sep 17 00:00:00 2001 From: David Hampton Date: Fri, 7 Apr 2006 04:26:59 +0000 Subject: [PATCH] Generate the gnc:count-data tags by hand so that the attribute will be written properly with all versions of libxml2. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13743 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 14 ++++++++++++++ src/backend/file/io-gncxml-v2.c | 11 +++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3bc41e71f..7801cb266a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-04-07 David Hampton + + * src/backend/file/io-gncxml-v2.c: The cvs version of libxml2 + refuses to write attribute tags that don't have valid namespaces. + Since gnucash writes the root node of the XML data file by hand, + there's no node with namespaces that can be passed in to the code + that generates the gnc:count-data tags. These tags must be + generated by hand as well. + + * src/backend/file/gnc-commodity-xml-v2.c: When writing a currency + to the data file, write the full commodity data block for backward + compatibility with 1.8, instead of just writing the quote source + information. + 2006-04-05 David Hampton * src/gnome-utils/gnc-main-window.c: diff --git a/src/backend/file/io-gncxml-v2.c b/src/backend/file/io-gncxml-v2.c index 19ea4f3f00..6a99ddc98b 100644 --- a/src/backend/file/io-gncxml-v2.c +++ b/src/backend/file/io-gncxml-v2.c @@ -779,12 +779,14 @@ write_counts(FILE* out, ...) while(type) { - xmlNodePtr node; - char *val; int amount = va_arg(ap, int); if(amount != 0) { +#if GNUCASH_REALLY_BUILD_AN_XML_TREE_ON_OUTPUT + char *val; + xmlNodePtr node; + val = g_strdup_printf("%d", amount); node = xmlNewNode(NULL, BAD_CAST COUNT_DATA_TAG); @@ -801,6 +803,11 @@ write_counts(FILE* out, ...) g_free(val); xmlFreeNode(node); +#else + fprintf(out, "<%s %s=\"%s\">%d\n", + COUNT_DATA_TAG, "cd:type", type, amount, COUNT_DATA_TAG); +#endif + } type = va_arg(ap, char *);