[Pkg-libvirt-commits] [libguestfs] 107/266: v2v: When outputting XML, write "<element/>" for nodes with no children.
Hilko Bengen
bengen at moszumanska.debian.org
Fri Oct 3 14:41:48 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag debian/1%1.27.35-1
in repository libguestfs.
commit 7ab495b458c2a93335266de2a24bc827785d18ca
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Fri Aug 15 10:07:27 2014 +0100
v2v: When outputting XML, write "<element/>" for nodes with no children.
---
v2v/DOM.ml | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/v2v/DOM.ml b/v2v/DOM.ml
index d828db4..cd4a47f 100644
--- a/v2v/DOM.ml
+++ b/v2v/DOM.ml
@@ -47,9 +47,13 @@ and element_to_chan chan
{ e_name = name; e_attrs = attrs; e_children = children } =
fprintf chan "<%s" name;
List.iter (fun (n, v) -> fprintf chan " %s='%s'" n (xml_quote_attr v)) attrs;
- output_char chan '>';
- List.iter (node_to_chan chan) children;
- fprintf chan "</%s>" name
+ if children <> [] then (
+ output_char chan '>';
+ List.iter (node_to_chan chan) children;
+ fprintf chan "</%s>" name
+ ) else (
+ output_string chan "/>"
+ )
let doc_to_chan chan doc =
fprintf chan "<?xml version='1.0' encoding='utf-8'?>\n";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list