From 0cd29676c0b6c72db84a9e817c1a3f81550d7e25 Mon Sep 17 00:00:00 2001 From: Cesare Tirabassi Date: Wed, 5 Aug 2009 17:50:24 +0200 Subject: [PATCH] Add xoap error handler to weather-forecast too --- src/weather.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/weather.c b/src/weather.c index 157f38ea..4265a253 100644 --- a/src/weather.c +++ b/src/weather.c @@ -108,6 +108,17 @@ static void parse_df(PWEATHER_FORECAST *res, xmlXPathContextPtr xpathCtx) char *content; xmlXPathObjectPtr xpathObj; + xpathObj = xmlXPathEvalExpression((const xmlChar *)"/error/err", xpathCtx); + if (xpathObj && xpathObj->nodesetval && xpathObj->nodesetval->nodeNr > 0 && + xpathObj->nodesetval->nodeTab[0]->type == XML_ELEMENT_NODE) { + content = (char *)xmlNodeGetContent(xpathObj->nodesetval->nodeTab[0]); + NORM_ERR("XOAP error: %s", content); + xmlFree(content); + xmlXPathFreeObject(xpathObj); + return; + } + xmlXPathFreeObject(xpathObj); + for (i = 0; i < NUM_XPATH_EXPRESSIONS_DF; i++) { xpathObj = xmlXPathEvalExpression((const xmlChar *)xpath_expression_df[i], xpathCtx); if (xpathObj != NULL) {