package tyxml

  1. Overview
  2. Docs
TyXML is a library for building correct HTML and SVG documents

Install

Dune Dependency

Authors

Maintainers

Sources

tyxml-4.4.0.tbz
sha256=516394dd4a5c31726997c51d66aa31cacb91e3c46d4e16c7699130e204042530
sha512=d5f2187f8410524cec7a14b28e8950837070eb0b6571b015dd06076c2841eb7ccaffa86d5d2307eaf1950ee62f9fb926477dac01c870d9c1a2f525853cb44d0c

doc/tyxml.functor/Xml_print/index.html

Module Xml_printSource

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

Sourceval encode_unsafe_char : string -> string

The 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_char is the default for ?encode in output and pretty_print below. Other implementations are provided by the module Netencoding in 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.

Sourceval encode_unsafe_char_and_at : string -> string

In addition, encode "@" as "&#64;" in the hope that this will fool simple minded email address harvesters.

Sourcemodule Utf8 : sig ... end

Utf8 normalizer and encoder for HTML.

Utilities

Sourceval compose_decl : ?version:string -> ?encoding:string -> unit -> string

encoding is the name of the character encoding, e.g. "US-ASCII" or "UTF-8"

Sourceval compose_doctype : string -> string list -> string
Sourceval string_of_number : float -> string

Convert a float to a string using a compact representation compatible with the Javascript norm.

Sourceval pp_number : Format.formatter -> float -> unit

Formatter functors

Printers for typed XML modules such as the one produced by Svg_f and Html_f.

Sourcemodule type TagList = sig ... end

List of tags that can be printed as empty tags: <foo />.

Printers for raw XML modules.

Deprecated functors

Use Make_fmt and Make_typed_fmt instead.

OCaml

Innovation. Community. Security.