Displaying 20 results from an estimated 29 matches for "xpath_get_nodes".
2017 Oct 27
0
[PATCH v11 7/8] mllib: add XPath helper xpath_get_nodes
...ex 3afee8b21..d2bfd3fb9 100644
--- a/common/mltools/xpath_helpers.ml
+++ b/common/mltools/xpath_helpers.ml
@@ -40,3 +40,12 @@ let xpath_eval parsefn xpathctx expr =
let xpath_string = xpath_eval identity
let xpath_int = xpath_eval int_of_string
let xpath_int64 = xpath_eval Int64.of_string
+
+let xpath_get_nodes xpathctx expr =
+ let obj = Xml.xpath_eval_expression xpathctx expr in
+ let nodes = ref [] in
+ for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
+ let node = Xml.xpathobj_node obj i in
+ push_front node nodes
+ done;
+ List.rev !nodes
diff --git a/common/mltools/xpath_helpers.mli b/common/...
2017 Oct 08
1
Re: [PATCH v11 5/6] mllib: add XPath helper xpath_get_nodes()
The subject says ‘xpath_get_nodes()‘, but this function doesn't
actually take a unit parameter, so it's better to drop ‘()’.
On Thu, Oct 05, 2017 at 04:58:29PM +0200, Cédric Bosdonnat wrote:
> +
> +let xpath_get_nodes xpathctx expr =
> + let obj = Xml.xpath_eval_expression xpathctx expr in
> + let nodes = ref...
2017 Apr 04
1
Re: [PATCH v5 09/10] mllib: add XPath helper xpath_get_nodes()
...path_helpers.ml
> @@ -53,3 +53,12 @@ let xpath_eval_default parsefn xpath expr default =
> let xpath_string_default = xpath_eval_default identity
> let xpath_int_default = xpath_eval_default int_of_string
> let xpath_int64_default = xpath_eval_default Int64.of_string
> +
> +let xpath_get_nodes xpathctx expr =
> + let obj = Xml.xpath_eval_expression xpathctx expr in
> + let nodes = ref [] in
> + for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
> + let node = Xml.xpathobj_node obj i in
> + nodes := List.append !nodes [node]
You can use the utilities from Common_utils...
2017 Mar 23
0
[PATCH v5 09/10] mllib: add XPath helper xpath_get_nodes()
...xpath_helpers.ml
+++ b/mllib/xpath_helpers.ml
@@ -53,3 +53,12 @@ let xpath_eval_default parsefn xpath expr default =
let xpath_string_default = xpath_eval_default identity
let xpath_int_default = xpath_eval_default int_of_string
let xpath_int64_default = xpath_eval_default Int64.of_string
+
+let xpath_get_nodes xpathctx expr =
+ let obj = Xml.xpath_eval_expression xpathctx expr in
+ let nodes = ref [] in
+ for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
+ let node = Xml.xpathobj_node obj i in
+ nodes := List.append !nodes [node]
+ done;
+ !nodes
diff --git a/mllib/xpath_helpers.mli b/mllib/xpath_...
2017 Sep 12
0
[PATCH v8 6/7] mllib: add XPath helper xpath_get_nodes()
...xpath_helpers.ml
+++ b/mllib/xpath_helpers.ml
@@ -52,3 +52,12 @@ let xpath_eval_default parsefn xpath expr default =
let xpath_string_default = xpath_eval_default identity
let xpath_int_default = xpath_eval_default int_of_string
let xpath_int64_default = xpath_eval_default Int64.of_string
+
+let xpath_get_nodes xpathctx expr =
+ let obj = Xml.xpath_eval_expression xpathctx expr in
+ let nodes = ref [] in
+ for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
+ let node = Xml.xpathobj_node obj i in
+ push_back nodes node
+ done;
+ !nodes
diff --git a/mllib/xpath_helpers.mli b/mllib/xpath_helpers.mli
in...
2017 Sep 18
0
[PATCH v9 5/7] mllib: add XPath helper xpath_get_nodes()
...xpath_helpers.ml
+++ b/mllib/xpath_helpers.ml
@@ -52,3 +52,12 @@ let xpath_eval_default parsefn xpath expr default =
let xpath_string_default = xpath_eval_default identity
let xpath_int_default = xpath_eval_default int_of_string
let xpath_int64_default = xpath_eval_default Int64.of_string
+
+let xpath_get_nodes xpathctx expr =
+ let obj = Xml.xpath_eval_expression xpathctx expr in
+ let nodes = ref [] in
+ for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
+ let node = Xml.xpathobj_node obj i in
+ push_back nodes node
+ done;
+ !nodes
diff --git a/mllib/xpath_helpers.mli b/mllib/xpath_helpers.mli
in...
2017 Sep 20
0
[PATCH v10 5/6] mllib: add XPath helper xpath_get_nodes()
...xpath_helpers.ml
+++ b/mllib/xpath_helpers.ml
@@ -52,3 +52,12 @@ let xpath_eval_default parsefn xpath expr default =
let xpath_string_default = xpath_eval_default identity
let xpath_int_default = xpath_eval_default int_of_string
let xpath_int64_default = xpath_eval_default Int64.of_string
+
+let xpath_get_nodes xpathctx expr =
+ let obj = Xml.xpath_eval_expression xpathctx expr in
+ let nodes = ref [] in
+ for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
+ let node = Xml.xpathobj_node obj i in
+ push_back nodes node
+ done;
+ !nodes
diff --git a/mllib/xpath_helpers.mli b/mllib/xpath_helpers.mli
in...
2017 Oct 05
0
[PATCH v11 5/6] mllib: add XPath helper xpath_get_nodes()
...pers.ml
+++ b/common/mltools/xpath_helpers.ml
@@ -52,3 +52,12 @@ let xpath_eval_default parsefn xpath expr default =
let xpath_string_default = xpath_eval_default identity
let xpath_int_default = xpath_eval_default int_of_string
let xpath_int64_default = xpath_eval_default Int64.of_string
+
+let xpath_get_nodes xpathctx expr =
+ let obj = Xml.xpath_eval_expression xpathctx expr in
+ let nodes = ref [] in
+ for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
+ let node = Xml.xpathobj_node obj i in
+ push_back nodes node
+ done;
+ !nodes
diff --git a/common/mltools/xpath_helpers.mli b/common/mltools/xp...
2018 Jun 07
0
[PATCH] v2v: parse_libvirt_xml: Simplify code by using xpath_get_nodes utility fn.
...obj = Xml.xpath_eval_expression xpathctx "/domain/features/*" in
- let nr_nodes = Xml.xpathobj_nr_nodes obj in
- for i = 0 to nr_nodes-1 do
- let node = Xml.xpathobj_node obj i in
- List.push_front (Xml.node_name node) features
- done;
- !features in
+ let nodes = xpath_get_nodes xpathctx "/domain/features/*" in
+ List.map Xml.node_name nodes in
let display =
let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/graphics" in
--
2.16.2
2017 Oct 27
15
[PATCH v11 0/8] virt-builder-repository
...9;s comments
Cédric Bosdonnat (7):
Ignore builder/*.out and *.img files
builder: change arch type to (string, string option) maybe.
builder: add Utils.get_image_infos function
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes
New tool: virt-builder-repository
Pino Toscano (1):
builder: add simple OCaml osinfo-db reader
.gitignore | 8 +
builder/Makefile.am | 129 ++++++-
builder/builder.ml | 9 +-
builder/cache.ml |...
2017 Oct 09
1
Re: [PATCH v11 6/6] New tool: virt-builder-repository
...ids with
> + | Some ids -> ids
> + | None -> (
> + let set = ref StringSet.empty in
> + Osinfo.iterate_db (
> + fun filepath ->
> + let doc = Xml.parse_file filepath in
> + let xpathctx = Xml.xpath_new_context doc in
> + let nodes = xpath_get_nodes xpathctx "/libosinfo/os/short-id" in
> + List.iter (
> + fun node ->
> + let id = Xml.node_as_string node in
> + set := StringSet.add id !set
> + ) nodes
> + );
> + osinfo_ids := Some (!set);
> + !set
> +...
2017 Oct 05
14
[PATCH v11 0/6] virt-builder-repository
Hi there,
This is an update of the series. Just to rebase it on top of
Rich's latest changes.
Cédric Bosdonnat (5):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
New tool: virt-builder-repository
Pino Toscano (1):
builder: add simple OCaml osinfo-db reader
.gitignore | 5 +
builder/Makefile.am | 128 ++++-
builder/builder.ml | 2 +-
builder/in...
2017 Sep 18
11
[PATCH v9 0/7] virt-builder-repository
...Remove the regex to increment the revision: Index_parser.get_entry()
only handles integers
* Fix Pino's comments
Cédric Bosdonnat (6):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
builder: remove useless fish dependency
New tool: virt-builder-repository
Pino Toscano (1):
ocaml osinfo database iterator
.gitignore | 5 +
builder/Makefile.am | 132 ++++-
builder/builder.ml...
2017 Sep 20
6
[PATCH v10 0/6] virt-builder-repository
Hi all,
Diff to v9 includes the changes requested by Pino.
Cédric Bosdonnat (5):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add XPath helper xpath_get_nodes()
New tool: virt-builder-repository
Pino Toscano (1):
builder: add simple OCaml osinfo-db reader
.gitignore | 5 +
builder/Makefile.am | 128 ++++-
builder/builder.ml | 2 +-
builder/in...
2017 Mar 23
13
[PATCH v5 00/10] Introducing virt-builder-repository
...DB traversing API
mllib: ocaml wrapper for lib/osinfo
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
dib: move do_cp to mllib.Commun_utils
mllib: add do_mv helper function to Common_utils
mllib: add XPath helper xpath_get_nodes()
Add a virt-builder-repository tool
.gitignore | 4 +
builder/Makefile.am | 121 ++++-
builder/builder.ml | 2 +-
builder/index.mli | 3 +
builder/index...
2017 Sep 12
10
[PATCH v8 0/7] virt-builder-repository tool
...ator and adding a
check of the mime type to filter potential image files.
Cédric Bosdonnat (6):
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add do_mv helper function to Common_utils
mllib: add XPath helper xpath_get_nodes()
Add a virt-builder-repository tool
Pino Toscano (1):
ocaml osinfo database iterator
.gitignore | 5 +
builder/Makefile.am | 133 ++++-
builder/builder.ml | 2 +-
builder/index.mli...
2017 Nov 14
1
Re: [PATCH v12 3/3] New tool: virt-builder-repository
...| Some ids -> ids
> + | None ->
> + osinfo_ids :=
> + Some (
> + Osinfo.fold (
> + fun set filepath ->
> + let doc = Xml.parse_file filepath in
> + let xpathctx = Xml.xpath_new_context doc in
> + let nodes = xpath_get_nodes xpathctx "/libosinfo/os/short-id" in
> + List.fold_left (
> + fun set node ->
> + let id = Xml.node_as_string node in
> + StringSet.add id set
> + ) set nodes
> + ) StringSet.empty
> + );...
2017 Jun 19
11
[PATCH v7 0/9] Introducing virt-builder-repository
...ng into a callback
lib: extract osinfo DB traversing API
mllib: ocaml wrapper for lib/osinfo
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
mllib: add do_mv helper function to Common_utils
mllib: add XPath helper xpath_get_nodes()
Add a virt-builder-repository tool
.gitignore | 4 +
builder/Makefile.am | 124 ++++-
builder/builder.ml | 2 +-
builder/index.mli | 3 +
builder/index...
2017 Apr 12
12
[PATCH v6 00/10] Add a virt-builder-repository tool
...DB traversing API
mllib: ocaml wrapper for lib/osinfo
builder: rename docs test script
builder: add a template parameter to get_index
builder: add Index.write_entry function
dib: move do_cp to mllib.Commun_utils
mllib: add do_mv helper function to Common_utils
mllib: add XPath helper xpath_get_nodes()
Add a virt-builder-repository tool
.gitignore | 4 +
builder/Makefile.am | 124 ++++-
builder/builder.ml | 2 +-
builder/index.mli | 3 +
builder/index...
2017 Mar 23
0
[PATCH v5 10/10] Add a virt-builder-repository tool
...Some ids -> ids
+ | None -> (
+ let set = ref StringSet.empty in
+ let g = open_guestfs () in
+
+ Osinfo.read_osinfo_db g#ocaml_handle (
+ fun filepath ->
+ let doc = Xml.parse_file filepath in
+ let xpathctx = Xml.xpath_new_context doc in
+ let nodes = xpath_get_nodes xpathctx "/libosinfo/os/short-id" in
+ List.iter (
+ fun node ->
+ let id = Xml.node_as_string node in
+ set := StringSet.add id !set
+ ) nodes
+ );
+ g#close ();
+ osinfo_ids := Some (!set);
+ !set
+ )
+
+let compress_to file o...