mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
James LewisMoss's patch with some xml and testing stuff.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3712 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -99,7 +99,7 @@ account_type_handler (xmlNodePtr node, Account* act)
|
||||
{
|
||||
int type;
|
||||
|
||||
xaccAccountStringToType(node->childs->content, &type);
|
||||
xaccAccountStringToType(node->xmlChildrenNode->content, &type);
|
||||
xaccAccountSetType(act, type);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include "sixtp-dom-generators.h"
|
||||
|
||||
#include "gnc-xml.h"
|
||||
|
||||
#include "gnc-engine-util.h"
|
||||
|
||||
#include "sixtp-dom-parsers.h"
|
||||
#include "AccountP.h"
|
||||
#include "Account.h"
|
||||
@@ -71,18 +71,29 @@ struct com_char_handler com_handlers[] = {
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static gboolean
|
||||
string_to_integer(const char *content, gint64 *to)
|
||||
{
|
||||
if(sscanf(content, "%lld", to) == 1)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_commodity_value(xmlNodePtr node, gnc_commodity* com)
|
||||
{
|
||||
if(safe_strcmp(node->name, "cmdty:fraction"))
|
||||
{
|
||||
/*
|
||||
gint64 val;
|
||||
if(string_to_integer(node, &val))
|
||||
if(string_to_integer(node->xmlChildrenNode->content, &val))
|
||||
{
|
||||
gnc_commodity_set_fraction(com, val);
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,26 +9,36 @@
|
||||
|
||||
#if defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#ifndef xmlChildrenNode
|
||||
#define xmlChildrenNode children
|
||||
#define xmlRootNode children
|
||||
#endif
|
||||
# include <libxml/tree.h>
|
||||
# include <libxml/parser.h>
|
||||
# include <libxml/xmlmemory.h>
|
||||
# include <libxml/parserInternals.h>
|
||||
# ifndef xmlChildrenNode
|
||||
# define xmlChildrenNode children
|
||||
# endif /* ifndef xmlChildrenNode */
|
||||
# ifndef xmlRootNode
|
||||
# define xmlRootNode children
|
||||
# endif /* ifndef xmlRootNode */
|
||||
# ifndef xmlAttrPropertyValue
|
||||
# define xmlAttrPropertyValue children
|
||||
# endif /* ifndef xmlAttrPropertyValue */
|
||||
|
||||
#else
|
||||
#else /* defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 */
|
||||
|
||||
#include <gnome-xml/tree.h>
|
||||
#include <gnome-xml/parser.h>
|
||||
#include <gnome-xml/xmlmemory.h>
|
||||
#include <gnome-xml/parserInternals.h>
|
||||
#ifndef xmlChildrenNode
|
||||
#define xmlChildrenNode childs
|
||||
#define xmlRootNode root
|
||||
#endif
|
||||
# include <gnome-xml/tree.h>
|
||||
# include <gnome-xml/parser.h>
|
||||
# include <gnome-xml/xmlmemory.h>
|
||||
# include <gnome-xml/parserInternals.h>
|
||||
# ifndef xmlChildrenNode
|
||||
# define xmlChildrenNode childs
|
||||
# endif /* ifndef xmlChildrenNode */
|
||||
# ifndef xmlRootNode
|
||||
# define xmlRootNode root
|
||||
# endif /* ifndef xmlRootNode */
|
||||
# ifndef xmlAttrPropertyValue
|
||||
# define xmlAttrPropertyValue val
|
||||
# endif /* ifndef xmlAttrPropertyValue */
|
||||
|
||||
#endif
|
||||
#endif /* defined(LIBXML_VERSION) && LIBXML_VERSION >= 20000 */
|
||||
|
||||
#endif /* _GNC_XML_HELPER_H_ */
|
||||
|
||||
@@ -30,14 +30,14 @@ dom_tree_to_guid(xmlNodePtr node)
|
||||
}
|
||||
|
||||
{
|
||||
char *type = node->properties->val->content;
|
||||
if(strcmp("guid", type) == 0)
|
||||
char *type = node->properties->xmlAttrPropertyValue->content;
|
||||
if(safe_strcmp("guid", type) == 0)
|
||||
{
|
||||
GUID *gid = g_new(GUID, 1);
|
||||
string_to_guid(node->xmlChildrenNode->content, gid);
|
||||
return gid;
|
||||
}
|
||||
else if(strcmp("new", type) == 0)
|
||||
else if(safe_strcmp("new", type) == 0)
|
||||
{
|
||||
/* FIXME: handle this case */
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user