This commit is contained in:
John Whitington 2016-11-13 18:04:13 +00:00
parent 2caa9de061
commit 2ec3f672c0
2 changed files with 552 additions and 596 deletions

25
xmlm.ml Normal file → Executable file
View File

@ -1173,31 +1173,6 @@ end
include Make(String) (Buffer)
(* Pretty printers *)
let pp = Format.fprintf
let rec pp_list ?(pp_sep = Format.pp_print_cut) pp_v ppf = function
| [] -> ()
| v :: vs ->
pp_v ppf v; if vs <> [] then (pp_sep ppf (); pp_list ~pp_sep pp_v ppf vs)
let pp_name ppf (p, l) = if p <> "" then pp ppf "%s:%s" p l else pp ppf "%s" l
let pp_attribute ppf (n, v) = pp ppf "@[<1>(%a,@,%S)@]" pp_name n v
let pp_tag ppf (name, atts) =
let pp_sep ppf () = pp ppf ";@ " in
pp ppf "@[<1>(%a,@,@[<1>[%a]@])@]"
pp_name name (pp_list ~pp_sep pp_attribute) atts
let pp_dtd ppf = function
| None -> pp ppf "None"
| Some dtd -> pp ppf "@[<1>(Some@ %S)@]" dtd
let pp_signal ppf = function
| `Data s -> pp ppf "@[`Data %S@]" s
| `El_end -> pp ppf "`El_end"
| `El_start tag -> pp ppf "@[`El_start %a@]" pp_tag tag
| `Dtd dtd -> pp ppf "@[`Dtd %a@]" pp_dtd dtd
(*----------------------------------------------------------------------------
Copyright 2007 Daniel C. Bünzli
All rights reserved.

19
xmlm.mli Normal file → Executable file
View File

@ -78,25 +78,6 @@ val ns_xmlns : string
(** Namespace name {{:http://www.w3.org/2000/xmlns/}value} bound to the
reserved ["xmlns"] prefix. *)
val pp_dtd : Format.formatter -> dtd -> unit
(** [pp_dtd ppf dtd] prints an unspecified representation of [dtd] on [ppf]. *)
val pp_name : Format.formatter -> name -> unit
(** [pp_name ppf name] prints an unspecified representation of [name] on
[ppf]. *)
val pp_attribute : Format.formatter -> attribute -> unit
(** [pp_attribute ppf att] prints an unspecified representation of [att] on
[ppf]. *)
val pp_tag : Format.formatter -> tag -> unit
(** [pp_tag ppf tag] prints an unspecified representation of [tag] on
[ppf]. *)
val pp_signal : Format.formatter -> signal -> unit
(** [pp_signal ppf s] prints an unspecified representation of [s] on
[ppf]. *)
(** {1 Input} *)
type pos = int * int