[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-glib 10/23] Add gvir_config_object_to_xml



---
 libvirt-gconfig/libvirt-gconfig-object.c |   19 +++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-object.h |    2 ++
 libvirt-gconfig/libvirt-gconfig.sym      |    1 +
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 762baf9..66102ec 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -293,6 +293,25 @@ void gvir_config_object_validate(GVirConfigObject *config,
     xmlRelaxNGFree(rng);
 }
 
+gchar *gvir_config_object_to_xml(GVirConfigObject *config)
+{
+    xmlChar *doc;
+    int size;
+    xmlNodePtr node;
+    gchar *output_doc;
+
+    node = gvir_config_object_get_xml_node(config, NULL);
+    if (node == NULL)
+        return NULL;
+
+    xmlDocDumpMemory(node->doc, &doc, &size);
+
+    output_doc = g_strdup((gchar *)doc);
+    xmlFree(doc);
+
+    return output_doc;
+}
+
 const gchar *gvir_config_object_get_doc(GVirConfigObject *config)
 {
     GVirConfigObjectPrivate *priv = config->priv;
diff --git a/libvirt-gconfig/libvirt-gconfig-object.h b/libvirt-gconfig/libvirt-gconfig-object.h
index a0c0489..f6ac28b 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.h
+++ b/libvirt-gconfig/libvirt-gconfig-object.h
@@ -62,6 +62,8 @@ GType gvir_config_object_get_type(void);
 void gvir_config_object_validate(GVirConfigObject *config,
                                  GError **err);
 
+gchar *gvir_config_object_to_xml(GVirConfigObject *config);
+
 const gchar *gvir_config_object_get_doc(GVirConfigObject *config);
 const gchar *gvir_config_object_get_schema(GVirConfigObject *config);
 xmlDocPtr  gvir_config_object_get_xml_doc(GVirConfigObject *config, GError **error);
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 2571c05..5c4492e 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -31,6 +31,7 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_object_get_schema;
 	gvir_config_object_get_xml_doc;
 	gvir_config_object_get_xml_node;
+	gvir_config_object_to_xml;
 	gvir_config_object_validate;
 
 	gvir_config_secret_get_type;
-- 
1.7.6.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]