[libvirt-glib 5/7] Add gvir_config_object_set_namespace helper

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

 



---
 libvirt-gconfig/libvirt-gconfig-object-private.h |    3 +++
 libvirt-gconfig/libvirt-gconfig-object.c         |   20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
index afd28f0..41cbfe8 100644
--- a/libvirt-gconfig/libvirt-gconfig-object-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -93,6 +93,9 @@ void gvir_config_object_foreach_child(GVirConfigObject *object,
                                       const char *parent_name,
                                       GVirConfigXmlNodeIterator iter_func,
                                       gpointer opaque);
+gboolean gvir_config_object_set_namespace(GVirConfigObject *object,
+                                          const char *ns,
+                                          const char *ns_uri);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 9d99faf..a42b36c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -871,3 +871,23 @@ gvir_config_object_remove_attribute(GVirConfigObject *object,
         status = xmlUnsetProp(object->priv->node, (xmlChar *)attr_name);
     } while (status == 0);
 }
+
+G_GNUC_INTERNAL gboolean
+gvir_config_object_set_namespace(GVirConfigObject *object, const char *ns,
+                                 const char *ns_uri)
+{
+    xmlNsPtr namespace;
+
+    g_return_val_if_fail(GVIR_CONFIG_IS_OBJECT(object), FALSE);
+    g_return_val_if_fail(ns != NULL, FALSE);
+    g_return_val_if_fail(ns_uri != NULL, FALSE);
+
+    namespace = xmlNewNs(object->priv->node,
+                         (xmlChar *)ns_uri, (xmlChar *)ns);
+    if (namespace == NULL)
+        return FALSE;
+
+    xmlSetNs(object->priv->node, namespace);
+
+    return TRUE;
+}
-- 
1.7.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]