Module Ocamlduce.Print


module Print: sig .. end
Exporting XML documents.

exception Error of string * {{Any}}
val serialize : start_elem:(string -> (string * string) list -> unit) ->
end_elem:(string -> unit) ->
empty_elem:(string -> (string * string) list -> unit) ->
text:(string -> unit) ->
?ns:Ocamlduce.NamespaceTable.t -> Ocamlduce.Load.anyxml -> unit
serialize ~start_elem ~end_elem ~empty_elem ~text ~ns v traverses the XML tree v and produce a linear representation of it by calling callback functions. All the strings passed to the callbacks are encoded in UTF-8.

The XML declaration is not displayed.

The function attaches bindings for XML Namespaces used in the tree to the root element. The optional argument ns can be used to provide hints to choose the prefixes.

If the value does not represent a valid XML tree, the exception Error is raised. This can only happen if the value of some attribute is not a string.

val print_xml : (string -> unit) ->
?data:(string -> unit) ->
?ns:Ocamlduce.NamespaceTable.t -> Ocamlduce.Load.anyxml -> unit
print f ~data ~ns v produces a textual representation of the XML tree v. The function f is used to display markup strings (tag and attribute names, brackets). An alternate function data can be provided to display the content (attribute value and PCDATA); if not given, these strings are displayed using the function f and with escaping for the special characters &,<,> and the double quote. Strings passed to f and data are encoded in UTF-8.

The argument ns has the same meaning as for serialize.