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:
Dave Peticolas
2001-02-27 20:15:11 +00:00
parent 1f0b3f280c
commit 5494d6ad07
11 changed files with 104 additions and 28 deletions

View File

@@ -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;
}

View File

@@ -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
{

View File

@@ -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_ */

View File

@@ -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;