aboutsummaryrefslogtreecommitdiff
path: root/lib/xml.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xml.ml')
-rw-r--r--lib/xml.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/xml.ml b/lib/xml.ml
new file mode 100644
index 0000000..fe4abdc
--- /dev/null
+++ b/lib/xml.ml
@@ -0,0 +1,10 @@
+type xml = Tag of string * xml list | String of string
+
+let tag name body = Tag (name, body)
+let format, format_list = Format.(fprintf, pp_print_list)
+
+let rec format_xml f = function
+ | Tag (name, body) ->
+ let format_body = format_list format_xml in
+ format f "@[<hv 3><%s>@,%a@;<0 -3></%s>@]" name format_body body name
+ | String text -> format f "%s" text