Module Xml_print
Printing utilities.
This module contains various encoding functions that can be used with Tyxml.Html.pp and Tyxml.Svg.pp.
It also contains functors to create printers for your own XML data structure.
Encoding functions
val encode_unsafe_char : string -> stringThe encoder maps strings to HTML and must encode the unsafe characters
'<','>','"','&'and the control characters 0-8, 11-12, 14-31, 127 to HTML entities.encode_unsafe_charis the default for?encodeinoutputandpretty_printbelow. Other implementations are provided by the moduleNetencodingin the OcamlNet library, e.g.:let encode = Netencoding.Html.encode ~in_enc:`Enc_iso88591 ~out_enc:`Enc_usascii ()Where national characters are replaced by HTML entities. The user is of course free to write her own implementation.
val encode_unsafe_char_and_at : string -> stringIn addition, encode
"@"as"@"in the hope that this will fool simple minded email address harvesters.
module Utf8 : sig ... endUtf8 normalizer and encoder for HTML.
Utilities
val compose_decl : ?version:string -> ?encoding:string -> unit -> stringencodingis the name of the character encoding, e.g."US-ASCII"or"UTF-8"
val compose_doctype : string -> string list -> stringval string_of_number : float -> stringConvert a float to a string using a compact representation compatible with the Javascript norm.
val pp_number : Stdlib.Format.formatter -> float -> unitSee
string_of_number.
Formatter functors
module Make_typed_fmt : functor (Xml : Xml_sigs.Iterable) -> functor (Typed_xml : Xml_sigs.Typed_xml with module Xml := Xml) -> Xml_sigs.Typed_pp with type 'a elt := 'a Typed_xml.elt and type doc := Typed_xml.docPrinters for typed XML modules such as the one produced by
Svg_fandHtml_f.
module type TagList = sig ... endList of tags that can be printed as empty tags:
<foo />.
module Make_fmt : functor (Xml : Xml_sigs.Iterable) -> functor (I : TagList) -> Xml_sigs.Pp with type elt := Xml.eltPrinters for raw XML modules.
Deprecated functors
Use Make_fmt and Make_typed_fmt instead.
module Make : functor (Xml : Xml_sigs.Iterable) -> functor (I : TagList) -> functor (O : Xml_sigs.Output) -> Xml_sigs.Printer with type out := O.out and type xml_elt := Xml.eltmodule Make_typed : functor (Xml : Xml_sigs.Iterable) -> functor (Typed_xml : Xml_sigs.Typed_xml with module Xml := Xml) -> functor (O : Xml_sigs.Output) -> Xml_sigs.Typed_printer with type out := O.out and type 'a elt := 'a Typed_xml.elt and type doc := Typed_xml.docmodule Make_simple : functor (Xml : Xml_sigs.Iterable) -> functor (I : TagList) -> Xml_sigs.Simple_printer with type xml_elt := Xml.eltmodule Make_typed_simple : functor (Xml : Xml_sigs.Iterable) -> functor (Typed_xml : Xml_sigs.Typed_xml with module Xml := Xml) -> Xml_sigs.Typed_simple_printer with type 'a elt := 'a Typed_xml.elt and type doc := Typed_xml.doc