From fe7a9e6eb4e01413beada869b1c93f4da9f050bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 27 Mar 2012 15:18:42 +0200 Subject: [PATCH] Bug #1184: XML template parser takes into account whitespaces text nodes --- src/template/Template.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/template/Template.cc b/src/template/Template.cc index d41f248fce..18227d4af6 100644 --- a/src/template/Template.cc +++ b/src/template/Template.cc @@ -443,8 +443,9 @@ Attribute * Template::single_xml_att(const xmlNode * node) Attribute * attr = 0; xmlNode * child = node->children; - if( child != 0 && (child->type == XML_TEXT_NODE || - child->type == XML_CDATA_SECTION_NODE)) + if( child->next == 0 && child != 0 && + (child->type == XML_TEXT_NODE || + child->type == XML_CDATA_SECTION_NODE)) { attr = new SingleAttribute( reinterpret_cast(node->name), @@ -464,7 +465,12 @@ Attribute * Template::vector_xml_att(const xmlNode * node) xmlNode * child = node->children; xmlNode * grandchild = 0; - if(child != 0 && child->type == XML_ELEMENT_NODE) + while(child != 0 && child->type != XML_ELEMENT_NODE) + { + child = child->next; + } + + if(child != 0) { attr = new VectorAttribute( reinterpret_cast(node->name));