
On Mon, Feb 06, 2012 at 12:56:15PM +0100, Christophe Fergeau wrote:
--- 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; +}
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|