package polyglot

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

Stream contains functions for turning XML signal streams into polyglot (X)HTML5 signal streams.

type 'a pump = 'a -> ('a * Xmlm.signal) option

'a pump is the type of XML signal streams springing from pumping 'a. When the stream is dry, None is returned.

type t

t is the type of polyglot stream contexts over Xmlm.output.

val of_xml_output : ?dtd:string -> Xmlm.output -> t

of_xml_output ?dtd xml_out creates a fresh polyglot stream context writing to xml_out. No default document type is prepended to the output so if one is desired, dtd should be passed with doctype.

val smart_doc_of_xml_output : ?dtd:string -> Xmlm.output -> t

smart_doc_of_xml_output ?dtd xml_out creates a fresh polyglot stream context writing to xml_out. The context will detect if the output is a complete HTML document and, if so, stream out Polyglot Markup. If the document is not a complete HTML document, as determined by DOCTYPE and root element, normal XML output will be used. No default document type is prepended to the output so if one is desired, dtd should be passed with doctype.

val push_signals : t -> Xmlm.signal list -> t

push_signals stream signals will convert signals to polyglot according to the context carried by stream and output them to stream's sink.

val output : ?nl:bool -> ?indent:int option -> ?ns_prefix:(string -> string option) -> Xmlm.dest -> 'a pump -> 'a -> unit

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

val output_doc : ?nl:bool -> ?indent:int option -> ?ns_prefix:(string -> string option) -> Xmlm.dest -> 'a pump -> 'a -> unit

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

val smart_output_doc : ?nl:bool -> ?indent:int option -> ?ns_prefix:(string -> string option) -> Xmlm.dest -> 'a pump -> 'a -> unit

smart_output_doc dest pump source detects whether the stream of signals from pump 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.