[libvirt] [libvirt-glib 3/7] Add gvir_config_xml_node_to_string helper

Christophe Fergeau cfergeau at redhat.com
Mon Feb 6 13:08:34 UTC 2012


On Mon, Feb 06, 2012 at 12:02:23PM +0000, Daniel P. Berrange wrote:
> In gvir_config_object_to_xml() we pass '1' for the 'format' argument
> to get pretty-printed XML. Perhaps we should do the same here too ?

Sure, makes sense to be consistent.
Actually, we could even go with this followup patch:


diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index a42b36c..662b8ed 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -256,21 +256,7 @@ void gvir_config_object_validate(GVirConfigObject *config,
 
 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);
-    if (node == NULL)
-        return NULL;
-
-    xmlDocDumpFormatMemory(node->doc, &doc, &size, 1);
-
-    output_doc = g_strdup((gchar *)doc);
-    xmlFree(doc);
-
-    return output_doc;
+    return gvir_config_xml_node_to_string(config->priv->node);
 }
 
 const gchar *gvir_config_object_get_schema(GVirConfigObject *config)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120206/cc347449/attachment-0001.sig>


More information about the libvir-list mailing list