From 821b3edba9daf6bdc8400fc5d989ace0ad13f094 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sat, 6 Nov 2010 23:33:55 -0400 Subject: [PATCH] Check for other whitespace in element names and not only tabs. It was still possible to use newline characters in the element names. Not really an error but definitely difficult to understand the output. --- src/xml.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/xml.c b/src/xml.c index 9f34e02e..e90890a1 100644 --- a/src/xml.c +++ b/src/xml.c @@ -62,13 +62,16 @@ gboolean is_literal_element(gchar **element) gboolean valid_xml_element(xmlChar *element) { - if (!element) - return FALSE; + gchar *p = (gchar *)element; - if (strchr((gchar *)element, '\t') || strchr((gchar *)element, ' ') || - *element == '!') + if (!element || *element == '!') return FALSE; + for (; *p; p++) { + if (g_ascii_isspace(*p)) + return FALSE; + } + return TRUE; } -- 2.11.4.GIT