Additional testing patch from James LewisMoss.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3621 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-02-08 07:52:17 +00:00
parent f6672b8490
commit 3afbeae315
3 changed files with 41 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2001-02-08 James LewisMoss <dres@phoenixdsl.com>
* src/engine/sixtp.c (sixtp_parse_file): Only set parse_result if
it points somewhere.
* src/engine/sixtp-to-dom-parser.c (dom_chars_handler): fix
character adding.
2001-02-07 James LewisMoss <dres@phoenixdsl.com>
* make-gnucash-patch.in: Add a file ending that is ignored.

View File

@ -1,5 +1,7 @@
#include <glib.h>
#include <ctype.h>
#include "sixtp-parsers.h"
#include "sixtp-utils.h"
#include "sixtp.h"
@ -22,24 +24,46 @@ static gboolean dom_start_handler(
{
thing = xmlNewChild(parent_data, global_namespace, tag, NULL);
}
while(*atptr != 0)
if(attrs != NULL)
{
xmlSetProp(thing, atptr[0], atptr[1]);
atptr += 2;
while(*atptr != 0)
{
xmlSetProp(thing, atptr[0], atptr[1]);
atptr += 2;
}
}
*result = thing;
*data_for_children = thing;
return TRUE;
}
static gboolean is_whitespace(const char *text, int len)
{
int i;
for(i = 0; i < len; i++)
{
if(!isspace(text[i]))
{
return FALSE;
}
}
return TRUE;
}
static gboolean dom_chars_handler(
GSList *sibling_data, gpointer parent_data, gpointer global_data,
gpointer *result, const char *text, int length)
{
xmlNodeSetContent((xmlNodePtr)result, text);
if(length > 0 && !is_whitespace(text, length))
{
gchar *stuff = g_strndup(text, length);
xmlNodeSetContent((xmlNodePtr)parent_data, stuff);
}
return TRUE;
}
static gboolean dom_before_handler(

View File

@ -606,13 +606,15 @@ sixtp_parse_file(sixtp *sixtp,
if(ctxt->data.parsing_ok)
{
*parse_result = ctxt->top_frame->frame_data;
if(parse_result)
*parse_result = ctxt->top_frame->frame_data;
sixtp_context_destroy(ctxt);
return TRUE;
}
else
{
*parse_result = NULL;
if(parse_result)
*parse_result = NULL;
sixtp_handle_catastrophe(&ctxt->data);
sixtp_context_destroy(ctxt);
return FALSE;
@ -653,4 +655,3 @@ sixtp_parse_buffer(sixtp *sixtp,
return FALSE;
}
}