[gupnp-av] Add function to dump XML of a DIDLObject
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-av] Add function to dump XML of a DIDLObject
- Date: Thu, 22 Nov 2012 15:59:18 +0000 (UTC)
commit 156943e00ad17f2a61731f362b19313ecaa6fbbf
Author: Jens Georg <mail jensge org>
Date: Thu Nov 22 16:58:16 2012 +0100
Add function to dump XML of a DIDLObject
libgupnp-av/gupnp-didl-lite-object.c | 27 +++++++++++++++++++++++++++
libgupnp-av/gupnp-didl-lite-object.h | 3 +++
2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/libgupnp-av/gupnp-didl-lite-object.c b/libgupnp-av/gupnp-didl-lite-object.c
index 30533c5..ff6bebf 100644
--- a/libgupnp-av/gupnp-didl-lite-object.c
+++ b/libgupnp-av/gupnp-didl-lite-object.c
@@ -2428,3 +2428,30 @@ gupnp_didl_lite_object_apply_fragments (GUPnPDIDLLiteObject *object,
xmlFreeDoc (modified.doc);
return result;
}
+
+/**
+ * gupnp_didl_lite_object_get_xml_string:
+ * @object: #GUPnPDIDLLiteObject
+ *
+ * Get the representation of this object as an XML string.
+ * Returns: (transfer full): XML representation of this object as string.
+ **/
+char *
+gupnp_didl_lite_object_get_xml_string (GUPnPDIDLLiteObject *object)
+{
+ xmlBuffer *buffer = NULL;
+ char *ret = NULL;
+
+ buffer = xmlBufferCreate ();
+ xmlNodeDump (buffer,
+ object->priv->xml_doc->doc,
+ object->priv->xml_node,
+ 0,
+ 0);
+
+ ret = g_strndup (BAD_CAST (xmlBufferContent (buffer)),
+ xmlBufferLength (buffer));
+ xmlBufferFree (buffer);
+
+ return ret;
+}
diff --git a/libgupnp-av/gupnp-didl-lite-object.h b/libgupnp-av/gupnp-didl-lite-object.h
index 6ca982d..872f26b 100644
--- a/libgupnp-av/gupnp-didl-lite-object.h
+++ b/libgupnp-av/gupnp-didl-lite-object.h
@@ -301,6 +301,9 @@ gupnp_didl_lite_object_apply_fragments
gchar **new_fragments,
gint new_size);
+char *
+gupnp_didl_lite_object_get_xml_string (GUPnPDIDLLiteObject *object);
+
G_END_DECLS
#endif /* __GUPNP_DIDL_LITE_OBJECT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]