X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fxmlutil.cpp;h=b71f07438104af505eb9b1bdd54cea12989a52a5;hb=da353f48b13fd79e446570d120369423f9c496dd;hp=6fc8f136e319e6bb3a80d9a301e0a7f9c1cfec04;hpb=240aff30845f7c20874ec9ee4115f3d7ea2a597e;p=metaproxy-moved-to-github.git diff --git a/src/xmlutil.cpp b/src/xmlutil.cpp index 6fc8f13..b71f074 100644 --- a/src/xmlutil.cpp +++ b/src/xmlutil.cpp @@ -1,5 +1,5 @@ -/* $Id: xmlutil.cpp,v 1.11 2006-12-01 12:37:26 marc Exp $ - Copyright (c) 2005-2006, Index Data. +/* $Id: xmlutil.cpp,v 1.13 2007-01-25 14:05:54 adam Exp $ + Copyright (c) 2005-2007, Index Data. See the LICENSE file for details */ @@ -17,15 +17,15 @@ static const std::string metaproxy_ns = "http://indexdata.com/metaproxy"; std::string mp_xml::get_text(const struct _xmlAttr *ptr) { - if (ptr->children->type == XML_TEXT_NODE) - return std::string((const char *) (ptr->children->content)); - return std::string(); + return get_text(ptr->children); } std::string mp_xml::get_text(const xmlNode *ptr) { std::string c; - for (ptr = ptr->children; ptr; ptr = ptr->next) + if (ptr && ptr->type != XML_TEXT_NODE) + ptr = ptr->children; + for (; ptr; ptr = ptr->next) if (ptr->type == XML_TEXT_NODE) c += std::string((const char *) (ptr->content)); return c;