package polyglot

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Tree contains functions for turning XML trees into polyglot (X)HTML5 trees.

type t = [ `Data of string | `El of Xmlm.tag * 'a list ] as 'a

t is the type of (X)HTML5 trees.

val output : ?nl:bool -> ?indent:int option -> ?ns_prefix:(string -> string option) -> Xmlm.dest -> t list -> unit

output dest trees outputs valid (X)HTML5 polyglot markup from a {!t} list trees. Only non-void element handling is implemented so far. For more information about the parameters, see Xmlm.make_output.

val output_doc : ?dtd:string -> ?nl:bool -> ?indent:int option -> ?ns_prefix:(string -> string option) -> Xmlm.dest -> t -> unit

output_doc dest tree outputs a valid (X)HTML5 polyglot document from a t tree. Only non-void element handling and default HTML5 DOCTYPE are implemented so far. For more information about the parameters, see Xmlm.make_output.

val smart_output_doc : ?dtd:string -> ?nl:bool -> ?indent:int option -> ?ns_prefix:(string -> string option) -> Xmlm.dest -> t -> unit

smart_output_doc dest tree detects whether tree is a complete HTML document, as determined by DOCTYPE and root element, and if so outputs a valid (X)HTML5 polyglot document like output_doc. If the input is not a complete HTML document, smart_output_doc simply outputs the document as XML.

OCaml

Innovation. Community. Security.