jon.recoil.org

Module Tyxml_xmlSource

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 and type touch_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 with type touch_event_handler = string
Sourcetype 'a wrap = 'a W.t
Sourcetype 'a list_wrap = 'a W.tlist
Sourcetype uri = string
Sourceval string_of_uri : (Tyxml_xml.uri, string) W.ft
Sourceval uri_of_string : (string, Tyxml_xml.uri) W.ft
Sourcetype aname = string
Sourcetype event_handler = string
Sourcetype mouse_event_handler = string
Sourcetype keyboard_event_handler = string
Sourcetype touch_event_handler = string
Sourcetype attrib
Sourceval string_attrib : Tyxml_xml.aname -> string Tyxml_xml.wrap -> Tyxml_xml.attrib
Sourceval space_sep_attrib : Tyxml_xml.aname -> string list Tyxml_xml.wrap -> Tyxml_xml.attrib
Sourceval comma_sep_attrib : Tyxml_xml.aname -> string list Tyxml_xml.wrap -> Tyxml_xml.attrib
Sourcetype elt
Sourcetype ename = string
Sourceval empty : unit -> Tyxml_xml.elt
Sourceval comment : string -> Tyxml_xml.elt
Sourceval pcdata : string Tyxml_xml.wrap -> Tyxml_xml.elt
Sourceval encodedpcdata : string Tyxml_xml.wrap -> Tyxml_xml.elt
Sourceval entity : string -> Tyxml_xml.elt
Sourceval cdata : string -> Tyxml_xml.elt
Sourceval cdata_script : string -> Tyxml_xml.elt
Sourceval cdata_style : string -> Tyxml_xml.elt
Sourcetype separator =
  1. | Space
  2. | Comma
Sourcetype acontent = private
  1. | AFloat of float
  2. | AInt of int
  3. | AStr of string
  4. | AStrL of Tyxml_xml.separator * string list
Sourcetype econtent = private
  1. | Empty
  2. | Comment of string
  3. | EncodedPCDATA of string
  4. | PCDATA of string
  5. | Entity of string
  6. | Leaf of Tyxml_xml.ename * Tyxml_xml.attrib list
  7. | Node of Tyxml_xml.ename * Tyxml_xml.attrib list * Tyxml_xml.elt list
include Xml_sigs.Pp with type elt := Tyxml_xml.elt
Sourceval pp : ?encode:(string -> string) -> ?indent:bool -> unit -> Stdlib.Format.formatter -> Tyxml_xml.elt -> unit

pp () is a Format printer for untyped XML.

It can be used in combination with "%a". For example, to get a string:

let s = Format.asprintf "%a" (pp ()) my_xml

A custom encoding function can be provided with the ~encode argument. Various implementations of encode are available in Xml_print.

Import/Export

Iterators

Recursively edit attributes for the element and all its children.

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.

Sourceval rm_attrib : (Tyxml_xml.aname -> bool) -> Tyxml_xml.attrib list -> Tyxml_xml.attrib list
Sourceval rm_attrib_from_list : (Tyxml_xml.aname -> bool) -> (string -> bool) -> Tyxml_xml.attrib list -> Tyxml_xml.attrib list
Sourceval map_int_attrib : (Tyxml_xml.aname -> bool) -> (int -> int) -> Tyxml_xml.attrib list -> Tyxml_xml.attrib list
Sourceval map_string_attrib : (Tyxml_xml.aname -> bool) -> (string -> string) -> Tyxml_xml.attrib list -> Tyxml_xml.attrib list
Sourceval map_string_attrib_in_list : (Tyxml_xml.aname -> bool) -> (string -> string) -> Tyxml_xml.attrib list -> Tyxml_xml.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.

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

Deprecated printers

Sourceval print_list : output:(string -> unit) -> ?encode:(string -> string) -> Tyxml_xml.elt list -> unit
  • deprecated Use Xml.pp instead.
  • deprecated Use Xml.pp instead.