aboutsummaryrefslogtreecommitdiff
path: root/lib/xml.ml
blob: fe4abdcf3a7a683c796fd8bdae76dd6a9384b007 (plain)
1
2
3
4
5
6
7
8
9
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