summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Burton <ross@linux.intel.com>2010-08-13 11:00:40 +0100
committerRoss Burton <ross@linux.intel.com>2010-10-05 13:03:53 +0100
commit2ce301cad5b0d962fe8ec8f3e08784f38e5c49af (patch)
treef9cae19e4f14b77d3f5d31f2f9a57ecd68cc575b
parent1e97f492ceae7fb6788c17ee5be062e81ae2e307 (diff)
downloadlibrest-xml.tar.gz
Add rest_proxy_call_get_payload_as_xmlxml
-rw-r--r--rest/rest-proxy-call.c22
-rw-r--r--rest/rest-proxy-call.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c
index 2cb4990..3c4d222 100644
--- a/rest/rest-proxy-call.c
+++ b/rest/rest-proxy-call.c
@@ -1220,3 +1220,25 @@ rest_proxy_call_get_status_message (RestProxyCall *call)
return priv->status_message;
}
+
+RestXmlNode *
+rest_proxy_call_get_payload_as_xml (RestProxyCall *call)
+{
+ RestProxyCallPrivate *priv;
+ static RestXmlParser *parser = NULL;
+ RestXmlNode *root;
+
+ g_return_val_if_fail (REST_IS_PROXY_CALL (call), NULL);
+ priv = GET_PRIVATE (call);
+
+ if (parser == NULL)
+ parser = rest_xml_parser_new ();
+
+ root = rest_xml_parser_parse_from_data_full (parser,
+ priv->payload,
+ priv->length,
+ priv->url,
+ g_hash_table_lookup (priv->content_params, "charset"));
+
+ return root;
+}
diff --git a/rest/rest-proxy-call.h b/rest/rest-proxy-call.h
index 6f65914..13a5c03 100644
--- a/rest/rest-proxy-call.h
+++ b/rest/rest-proxy-call.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <rest/rest-params.h>
+#include <rest/rest-xml-parser.h>
G_BEGIN_DECLS
@@ -185,6 +186,8 @@ const gchar *rest_proxy_call_get_payload (RestProxyCall *call);
guint rest_proxy_call_get_status_code (RestProxyCall *call);
const gchar *rest_proxy_call_get_status_message (RestProxyCall *call);
+RestXmlNode *rest_proxy_call_get_payload_as_xml (RestProxyCall *call);
+
G_END_DECLS
#endif /* _REST_PROXY_CALL */