summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2009-03-27 15:05:29 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2009-03-27 15:05:29 +0000
commitf6f8ffcd6e0c11bdcfdc52a5e7846c0f27ef85df (patch)
tree4fcc36d907129204c885315be7d8b884ed247fbf
parentdd9382d05b5f6a4370af709a5b379a862f56e3d4 (diff)
downloadlasso-f6f8ffcd6e0c11bdcfdc52a5e7846c0f27ef85df.tar.gz
lasso-f6f8ffcd6e0c11bdcfdc52a5e7846c0f27ef85df.tar.xz
lasso-f6f8ffcd6e0c11bdcfdc52a5e7846c0f27ef85df.zip
Core: remove use of XPath
* lasso/xml/xml.c: in lasso_node_new_from_soap, instead of using XPath use function lasso_xml_get_soap_content.
-rw-r--r--lasso/xml/xml.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index e4d22345..90003571 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -34,10 +34,6 @@
#include "private.h"
#include <ctype.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#include <libxml/parser.h>
-#include <libxml/parserInternals.h>
#include <xmlsec/base64.h>
#include <xmlsec/xmltree.h>
@@ -1380,23 +1376,19 @@ LassoNode*
lasso_node_new_from_soap(const char *soap)
{
xmlDoc *doc;
- xmlXPathContext *xpathCtx;
- xmlXPathObject *xpathObj;
xmlNode *xmlnode;
LassoNode *node = NULL;
doc = lasso_xml_parse_memory(soap, strlen(soap));
- xpathCtx = xmlXPathNewContext(doc);
- xmlXPathRegisterNs(xpathCtx, (xmlChar*)"s", (xmlChar*)LASSO_SOAP_ENV_HREF);
- xpathObj = xmlXPathEvalExpression((xmlChar*)"//s:Body/*", xpathCtx);
-
- if (xpathObj && xpathObj->nodesetval && xpathObj->nodesetval->nodeNr) {
- xmlnode = xpathObj->nodesetval->nodeTab[0];
- node = lasso_node_new_from_xmlNode(xmlnode);
+ if (doc == NULL) {
+ return NULL;
+ }
+ xmlnode = lasso_xml_get_soap_content(xmlDocGetRootElement(doc));
+ if (xmlnode == NULL) {
+ return NULL;
}
+ node = lasso_node_new_from_xmlNode(xmlnode);
- xmlXPathFreeContext(xpathCtx);
- xmlXPathFreeObject(xpathObj);
lasso_release_doc(doc);
return node;