Signed-off-by: Shahar Havivi <shaharh(a)redhat.com>
---
v2v/xml-c.c | 15 +++++++++++++++
v2v/xml.ml | 1 +
v2v/xml.mli | 2 ++
3 files changed, 18 insertions(+)
diff --git a/v2v/xml-c.c b/v2v/xml-c.c
index 4c9bc77..aea62ae 100644
--- a/v2v/xml-c.c
+++ b/v2v/xml-c.c
@@ -141,6 +141,21 @@ v2v_xml_xpath_new_context (value docv)
}
value
+v2v_xml_xpath_register_ns (value xpathctxv, value prefix, value uri)
+{
+ CAMLparam3 (xpathctxv, prefix, uri);
+ xmlXPathContextPtr xpathctx;
+ int r;
+
+ xpathctx = Xpathctx_val (xpathctxv);
+ r = xmlXPathRegisterNs (xpathctx, BAD_CAST String_val (prefix), BAD_CAST String_val
(uri));
+ if (r == -1)
+ caml_invalid_argument ("xpath_register_ns: unable to register
namespace");
+
+ CAMLreturn (Val_unit);
+}
+
+value
v2v_xml_xpath_eval_expression (value xpathctxv, value exprv)
{
CAMLparam2 (xpathctxv, exprv);
diff --git a/v2v/xml.ml b/v2v/xml.ml
index 78cb022..fea8784 100644
--- a/v2v/xml.ml
+++ b/v2v/xml.ml
@@ -31,6 +31,7 @@ type node = doc * node_ptr
external parse_memory : string -> doc = "v2v_xml_parse_memory"
external xpath_new_context : doc -> xpathctx = "v2v_xml_xpath_new_context"
external xpath_eval_expression : xpathctx -> string -> xpathobj =
"v2v_xml_xpath_eval_expression"
+external xpath_register_ns : xpathctx -> string -> string -> unit =
"v2v_xml_xpath_register_ns"
external xpathobj_nr_nodes : xpathobj -> int = "v2v_xml_xpathobj_nr_nodes"
external xpathobj_get_node_ptr : xpathobj -> int -> node_ptr =
"v2v_xml_xpathobj_get_node_ptr"
diff --git a/v2v/xml.mli b/v2v/xml.mli
index 38bb9cd..8eefecc 100644
--- a/v2v/xml.mli
+++ b/v2v/xml.mli
@@ -29,6 +29,8 @@ val xpath_new_context : doc -> xpathctx
(** xmlXPathNewContext *)
val xpath_eval_expression : xpathctx -> string -> xpathobj
(** xmlXPathEvalExpression *)
+val xpath_register_ns : xpathctx -> string -> string -> unit
+(** xmlXPathRegisterNs *)
val xpathobj_nr_nodes : xpathobj -> int
(** Get the number of nodes in the node set of the xmlXPathObjectPtr. *)
--
1.9.3