[librest/xml: 4/4] Add rest_proxy_call_get_payload_as_xml
- From: Ross Burton <rburton src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librest/xml: 4/4] Add rest_proxy_call_get_payload_as_xml
- Date: Tue, 5 Oct 2010 12:05:59 +0000 (UTC)
commit 2ce301cad5b0d962fe8ec8f3e08784f38e5c49af
Author: Ross Burton <ross linux intel com>
Date: Fri Aug 13 11:00:40 2010 +0100
Add rest_proxy_call_get_payload_as_xml
rest/rest-proxy-call.c | 22 ++++++++++++++++++++++
rest/rest-proxy-call.h | 3 +++
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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]