mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
v2v: DOM: Make 'doc' and 'element' types distinct.
No functional change, just enforces the distinct type for callers.
This commit is contained in:
@@ -32,10 +32,10 @@ and element = {
|
||||
mutable e_children : node list; (* Child elements. *)
|
||||
}
|
||||
and attr = string * string
|
||||
and doc = element
|
||||
and doc = Doc of element
|
||||
|
||||
let doc name attrs children =
|
||||
{ e_name = name; e_attrs = attrs; e_children = children }
|
||||
Doc { e_name = name; e_attrs = attrs; e_children = children }
|
||||
|
||||
let e name attrs children =
|
||||
Element { e_name = name; e_attrs = attrs; e_children = children }
|
||||
@@ -98,12 +98,12 @@ and xml_quote_pcdata str =
|
||||
let str = String.replace str ">" ">" in
|
||||
str
|
||||
|
||||
let doc_to_chan chan doc =
|
||||
let doc_to_chan chan (Doc doc) =
|
||||
fprintf chan "<?xml version='1.0' encoding='utf-8'?>\n";
|
||||
element_to_chan chan doc;
|
||||
fprintf chan "\n"
|
||||
|
||||
let path_to_nodes doc path =
|
||||
let path_to_nodes (Doc doc) path =
|
||||
match path with
|
||||
| [] -> invalid_arg "path_to_nodes: empty path"
|
||||
| top_name :: path ->
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
(** Poor man's XML DOM, mutable for ease of modification. *)
|
||||
|
||||
type element
|
||||
type doc = element
|
||||
type doc = Doc of element
|
||||
type attr = string * string
|
||||
|
||||
type node =
|
||||
|
||||
Reference in New Issue
Block a user