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

[Libguestfs] [PATCH 3/4] v2v: xml: Add a binding for XmlUnsetProp.



---
 v2v/xml-c.c | 12 ++++++++++++
 v2v/xml.ml  |  3 +++
 v2v/xml.mli |  3 +++
 3 files changed, 18 insertions(+)

diff --git a/v2v/xml-c.c b/v2v/xml-c.c
index 97b8a20..a6d9231 100644
--- a/v2v/xml-c.c
+++ b/v2v/xml-c.c
@@ -353,6 +353,18 @@ v2v_xml_node_ptr_set_prop (value nodev, value namev, value valv)
 }
 
 value
+v2v_xml_node_ptr_unset_prop (value nodev, value namev)
+{
+  CAMLparam2 (nodev, namev);
+  xmlNodePtr node = (xmlNodePtr) nodev;
+  int r;
+
+  r = xmlUnsetProp (node, BAD_CAST String_val (namev));
+
+  CAMLreturn (r == 0 ? Val_true : Val_false);
+}
+
+value
 v2v_xml_node_ptr_unlink_node (value nodev)
 {
   CAMLparam1 (nodev);
diff --git a/v2v/xml.ml b/v2v/xml.ml
index dbb2b41..27c8566 100644
--- a/v2v/xml.ml
+++ b/v2v/xml.ml
@@ -95,6 +95,9 @@ let new_text_child (doc_ptr, node_ptr) name content =
 external node_ptr_set_prop : node_ptr -> string -> string -> unit = "v2v_xml_node_ptr_set_prop"
 let set_prop (doc_ptr, node_ptr) = node_ptr_set_prop node_ptr
 
+external node_ptr_unset_prop : node_ptr -> string -> bool = "v2v_xml_node_ptr_unset_prop"
+let unset_prop (doc_ptr, node_ptr) = node_ptr_unset_prop node_ptr
+
 external node_ptr_unlink_node : node_ptr -> unit = "v2v_xml_node_ptr_unlink_node"
 let unlink_node (doc_ptr, node_ptr) = node_ptr_unlink_node node_ptr
 
diff --git a/v2v/xml.mli b/v2v/xml.mli
index b039d09..9664c73 100644
--- a/v2v/xml.mli
+++ b/v2v/xml.mli
@@ -73,6 +73,9 @@ val new_text_child : node -> string -> string -> node
 val set_prop : node -> string -> string -> unit
 (** xmlSetProp *)
 
+val unset_prop : node -> string -> bool
+(** xmlUnsetProp (returns [true] if the property was removed) *)
+
 val unlink_node : node -> unit
 (** xmlUnlinkNode
     {b NB:} This frees the [node], do not use it afterwards. *)
-- 
2.5.0


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