gchar *obt_parse_node_string(xmlNodePtr node)
{
xmlChar *c = xmlNodeGetContent(node);
- gchar *s = g_strdup(c ? (gchar*)c : "");
+ gchar *s;
+ if (c) g_strstrip((char*)c); /* strip leading/trailing whitespace */
+ s = g_strdup(c ? (gchar*)c : "");
xmlFree(c);
return s;
}
gint obt_parse_node_int(xmlNodePtr node)
{
xmlChar *c = xmlNodeGetContent(node);
- gint i = c ? atoi((gchar*)c) : 0;
+ gint i;
+ if (c) g_strstrip((char*)c); /* strip leading/trailing whitespace */
+ i = c ? atoi((gchar*)c) : 0;
xmlFree(c);
return i;
}
{
xmlChar *c = xmlNodeGetContent(node);
gboolean b = FALSE;
+ if (c) g_strstrip((char*)c); /* strip leading/trailing whitespace */
if (c && !xmlStrcasecmp(c, (const xmlChar*) "true"))
b = TRUE;
else if (c && !xmlStrcasecmp(c, (const xmlChar*) "yes"))
{
xmlChar *c = xmlNodeGetContent(node);
gboolean r;
+ if (c) g_strstrip((char*)c); /* strip leading/trailing whitespace */
r = !xmlStrcasecmp(c, (const xmlChar*) val);
xmlFree(c);
return r;
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
gboolean r = FALSE;
if (c) {
+ g_strstrip((char*)c); /* strip leading/trailing whitespace */
if (!xmlStrcasecmp(c, (const xmlChar*) "true"))
*value = TRUE, r = TRUE;
else if (!xmlStrcasecmp(c, (const xmlChar*) "yes"))
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
gboolean r = FALSE;
if (c) {
+ g_strstrip((char*)c); /* strip leading/trailing whitespace */
*value = atoi((gchar*)c);
r = TRUE;
}
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
gboolean r = FALSE;
if (c) {
+ g_strstrip((char*)c); /* strip leading/trailing whitespace */
*value = g_strdup((gchar*)c);
r = TRUE;
}
{
xmlChar *c = xmlGetProp(node, (const xmlChar*) name);
gboolean r = FALSE;
- if (c)
+ if (c) {
+ g_strstrip((char*)c); /* strip leading/trailing whitespace */
r = !xmlStrcasecmp(c, (const xmlChar*) val);
+ }
xmlFree(c);
return r;
}