mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-06-26 Dave Peticolas <dave@krondo.com>
* src/engine/sixtp-dom-parsers.c: same as below * src/engine/gnc-commodity-xml-v2.c: same as below * src/engine/gnc-account-xml-v2.c: don't use node content member directly -- if libxml was configured to use buffers, this won't work. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4812 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
c0a40468bf
commit
a88197d809
@ -1,5 +1,13 @@
|
|||||||
2001-06-26 Dave Peticolas <dave@krondo.com>
|
2001-06-26 Dave Peticolas <dave@krondo.com>
|
||||||
|
|
||||||
|
* src/engine/sixtp-dom-parsers.c: same as below
|
||||||
|
|
||||||
|
* src/engine/gnc-commodity-xml-v2.c: same as below
|
||||||
|
|
||||||
|
* src/engine/gnc-account-xml-v2.c: don't use node content member
|
||||||
|
directly -- if libxml was configured to use buffers, this won't
|
||||||
|
work.
|
||||||
|
|
||||||
* src/register/gnome/gnucash-sheet.c
|
* src/register/gnome/gnucash-sheet.c
|
||||||
(gnucash_sheet_key_press_event): allow shift-pgup and shift-pgdn
|
(gnucash_sheet_key_press_event): allow shift-pgup and shift-pgdn
|
||||||
to go to top & bottom of register respectively.
|
to go to top & bottom of register respectively.
|
||||||
|
@ -163,9 +163,14 @@ static gboolean
|
|||||||
account_type_handler (xmlNodePtr node, gpointer act)
|
account_type_handler (xmlNodePtr node, gpointer act)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
|
char *string;
|
||||||
|
|
||||||
|
string = xmlNodeGetContent (node->xmlChildrenNode);
|
||||||
|
xaccAccountStringToType(string, &type);
|
||||||
|
xmlFree (string);
|
||||||
|
|
||||||
xaccAccountStringToType(node->xmlChildrenNode->content, &type);
|
|
||||||
xaccAccountSetType((Account*)act, type);
|
xaccAccountSetType((Account*)act, type);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,10 +103,14 @@ set_commodity_value(xmlNodePtr node, gnc_commodity* com)
|
|||||||
if(safe_strcmp(node->name, "cmdty:fraction") == 0)
|
if(safe_strcmp(node->name, "cmdty:fraction") == 0)
|
||||||
{
|
{
|
||||||
gint64 val;
|
gint64 val;
|
||||||
if(string_to_gint64(node->xmlChildrenNode->content, &val))
|
char *string;
|
||||||
|
|
||||||
|
string = xmlNodeGetContent (node->xmlChildrenNode);
|
||||||
|
if(string_to_gint64(string, &val))
|
||||||
{
|
{
|
||||||
gnc_commodity_set_fraction(com, val);
|
gnc_commodity_set_fraction(com, val);
|
||||||
}
|
}
|
||||||
|
xmlFree (string);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -54,12 +54,20 @@ dom_tree_to_guid(xmlNodePtr node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
char *type = node->properties->xmlAttrPropertyValue->content;
|
char *type;
|
||||||
|
|
||||||
|
type = xmlNodeGetContent (node->properties->xmlAttrPropertyValue);
|
||||||
|
|
||||||
/* handle new and guid the same for the moment */
|
/* handle new and guid the same for the moment */
|
||||||
if((safe_strcmp("guid", type) == 0) || (safe_strcmp("new", type) == 0))
|
if((safe_strcmp("guid", type) == 0) || (safe_strcmp("new", type) == 0))
|
||||||
{
|
{
|
||||||
GUID *gid = g_new(GUID, 1);
|
GUID *gid = g_new(GUID, 1);
|
||||||
string_to_guid(node->xmlChildrenNode->content, gid);
|
char *guid_str;
|
||||||
|
|
||||||
|
guid_str = xmlNodeGetContent (node->xmlChildrenNode);
|
||||||
|
string_to_guid(guid_str, gid);
|
||||||
|
xmlFree (guid_str);
|
||||||
|
xmlFree (type);
|
||||||
return gid;
|
return gid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -68,6 +76,7 @@ dom_tree_to_guid(xmlNodePtr node)
|
|||||||
type ? type : "(null)",
|
type ? type : "(null)",
|
||||||
node->properties->name ?
|
node->properties->name ?
|
||||||
(char *) node->properties->name : "(null)");
|
(char *) node->properties->name : "(null)");
|
||||||
|
xmlFree (type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,10 +412,7 @@ dom_tree_to_text(xmlNodePtr tree)
|
|||||||
|
|
||||||
Ignores comment nodes and collapse text nodes into one string.
|
Ignores comment nodes and collapse text nodes into one string.
|
||||||
Returns NULL if expectations are unsatisfied.
|
Returns NULL if expectations are unsatisfied.
|
||||||
|
*/
|
||||||
If there are a lot of text sub-nodes, this algorithm may be
|
|
||||||
inefficient as it will reallocate a lot. */
|
|
||||||
|
|
||||||
gboolean ok = TRUE;
|
gboolean ok = TRUE;
|
||||||
xmlNodePtr current;
|
xmlNodePtr current;
|
||||||
gchar *result;
|
gchar *result;
|
||||||
@ -419,34 +425,11 @@ dom_tree_to_text(xmlNodePtr tree)
|
|||||||
return g_strdup("");
|
return g_strdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
temp = xmlNodeListGetString (NULL, tree->xmlChildrenNode, TRUE);
|
||||||
|
if (!temp) return NULL;
|
||||||
|
|
||||||
result = g_strdup("");
|
result = g_strdup (temp);
|
||||||
|
xmlFree (temp);
|
||||||
for(current = tree->xmlChildrenNode; current; current = current->next) {
|
|
||||||
switch(current->type) {
|
|
||||||
case XML_TEXT_NODE:
|
|
||||||
temp = g_strconcat(result, (gchar *) current->content, NULL);
|
|
||||||
g_free(result);
|
|
||||||
result = temp;
|
|
||||||
break;
|
|
||||||
case XML_COMMENT_NODE:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
PERR("dom_tree_to_text: hit illegal node while extracting text.");
|
|
||||||
PERR(" (name %s) (type %d) (content %s)",
|
|
||||||
current->name ? (char *) current->name : "(null)",
|
|
||||||
current->type,
|
|
||||||
current->content ? (char *) current->content : "(null)");
|
|
||||||
current = NULL;
|
|
||||||
ok = FALSE;
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!ok) {
|
|
||||||
if(result) g_free(result);
|
|
||||||
result = NULL;
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user