From: miker Date: Mon, 21 May 2007 16:33:29 +0000 (+0000) Subject: ignore non-leaf text nodes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bb0ab1e330eb4aeb80a0d8e72f066356314c3df0;p=opensrf%2Fbjwebb.git ignore non-leaf text nodes git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@913 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/utils/xml_utils.c b/src/utils/xml_utils.c index 15a350b..cb2164f 100644 --- a/src/utils/xml_utils.c +++ b/src/utils/xml_utils.c @@ -48,10 +48,16 @@ jsonObject* _xmlToJSON(xmlNodePtr node, jsonObject* obj) { } xmlNodePtr child = node->children; - while(child) { - _xmlToJSON(child, new_obj); - child = child->next; - } + if (child) { // at least one... + if (child != node->last) { // more than one -- ignore TEXT nodes + while(child) { + if (child->type != XML_TEXT_NODE) _xmlToJSON(child, new_obj); + child = child->next; + } + } else { + _xmlToJSON(child, new_obj); + } + } } return obj;