package tyxml

  1. Overview
  2. Docs

Basic functions for construction and manipulation of XML tree.

include Xml_sigs.Iterable with type uri = string and type event_handler = string and type mouse_event_handler = string and type keyboard_event_handler = string
include Xml_sigs.NoWrap with type uri = string with type event_handler = string with type mouse_event_handler = string with type keyboard_event_handler = string
module W = Xml_wrap.NoWrap
type 'a wrap = 'a W.t
type 'a list_wrap = 'a W.tlist
type uri = string
val string_of_uri : (uri, string) W.ft
val uri_of_string : (string, uri) W.ft
type aname = string
type event_handler = string
type mouse_event_handler = string
type keyboard_event_handler = string
type attrib
val float_attrib : aname -> float wrap -> attrib
val int_attrib : aname -> int wrap -> attrib
val string_attrib : aname -> string wrap -> attrib
val space_sep_attrib : aname -> string list wrap -> attrib
val comma_sep_attrib : aname -> string list wrap -> attrib
val event_handler_attrib : aname -> event_handler -> attrib
val mouse_event_handler_attrib : aname -> mouse_event_handler -> attrib
val keyboard_event_handler_attrib : aname -> keyboard_event_handler -> attrib
val uri_attrib : aname -> uri wrap -> attrib
val uris_attrib : aname -> uri list wrap -> attrib
type elt
type ename = string
val empty : unit -> elt
val comment : string -> elt
val pcdata : string wrap -> elt
val encodedpcdata : string wrap -> elt
val entity : string -> elt
val leaf : ?a:attrib list -> ename -> elt
val node : ?a:attrib list -> ename -> elt list_wrap -> elt
val cdata : string -> elt
val cdata_script : string -> elt
val cdata_style : string -> elt
type separator =
  1. | Space
  2. | Comma
val aname : attrib -> aname
type acontent = private
  1. | AFloat of float
  2. | AInt of int
  3. | AStr of string
  4. | AStrL of separator * string list
val acontent : attrib -> acontent
type econtent = private
  1. | Empty
  2. | Comment of string
  3. | EncodedPCDATA of string
  4. | PCDATA of string
  5. | Entity of string
  6. | Leaf of ename * attrib list
  7. | Node of ename * attrib list * elt list
val content : elt -> econtent
val pp : ?encode:(string -> string) -> unit -> Stdlib.Format.formatter -> elt -> unit

Iterators

val amap : (ename -> attrib list -> attrib list) -> elt -> elt

Recursively edit attributes for the element and all its children.

val amap1 : (ename -> attrib list -> attrib list) -> elt -> elt

Edit attributes only for one element.

The following can safely be exported by higher level libraries, because removing an attribute from a element is always legal.

val rm_attrib : (aname -> bool) -> attrib list -> attrib list
val rm_attrib_from_list : (aname -> bool) -> (string -> bool) -> attrib list -> attrib list
val map_int_attrib : (aname -> bool) -> (int -> int) -> attrib list -> attrib list
val map_string_attrib : (aname -> bool) -> (string -> string) -> attrib list -> attrib list
val map_string_attrib_in_list : (aname -> bool) -> (string -> string) -> attrib list -> attrib list

Exporting the following by higher level libraries would drive a hole through a type system, because they allow to add any attribute to any element.

val add_int_attrib : aname -> int -> attrib list -> attrib list
val add_string_attrib : aname -> string -> attrib list -> attrib list
val add_comma_sep_attrib : aname -> string -> attrib list -> attrib list
val add_space_sep_attrib : aname -> string -> attrib list -> attrib list
val fold : (unit -> 'a) -> (string -> 'a) -> (string -> 'a) -> (string -> 'a) -> (string -> 'a) -> (ename -> attrib list -> 'a) -> (ename -> attrib list -> 'a list -> 'a) -> elt -> 'a
val all_entities : elt -> string list
val translate : (ename -> attrib list -> elt) -> (ename -> attrib list -> elt list -> elt) -> ('state -> ename -> attrib list -> elt list) -> ('state -> ename -> attrib list -> elt list -> elt list) -> (ename -> attrib list -> 'state -> 'state) -> 'state -> elt -> elt

Deprecated printers

val print_list : output:(string -> unit) -> ?encode:(string -> string) -> elt list -> unit
  • deprecated Use Xml.pp instead.
val print : Stdlib.Format.formatter -> elt -> unit
  • deprecated Use Xml.pp instead.
OCaml

Innovation. Community. Security.