From 07a7b6952d0e27a252e12ef720bbc4d3e43bcd8b Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Mon, 13 Oct 2003 02:00:10 +0000 Subject: [PATCH] Patch #820699: corrects interpretation of Object-text nodes when it consists of a single Field node. Interpretation gets screwed up by the automatic XML indentation. Patch provided by: Emmanuel Pacaud . git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@312 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/src/xml-label.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/glabels2/src/xml-label.c b/glabels2/src/xml-label.c index 9df777b3..21c19d77 100644 --- a/glabels2/src/xml-label.c +++ b/glabels2/src/xml-label.c @@ -876,12 +876,18 @@ xml_parse_toplevel_span (xmlNodePtr node, for (child = node->xmlChildrenNode; child != NULL; child = child->next) { if (xmlNodeIsText (child)) { - - /* Literal text */ - text_node = g_new0 (glTextNode, 1); - text_node->field_flag = FALSE; - text_node->data = xmlNodeGetContent (child); - text_nodes = g_list_append (text_nodes, text_node); + gchar *data = xmlNodeGetContent (child); + + /* Hack: if the first char is LF, it's a xml formatting string */ + if (data[0] != '\n') { + /* Literal text */ + text_node = g_new0 (glTextNode, 1); + text_node->field_flag = FALSE; + text_node->data = data; + text_nodes = g_list_append (text_nodes, text_node); + } + else + g_free (data); } else if (xmlStrEqual (child->name, "Span")) { -- 2.39.5