package SZXX

  1. Overview
  2. Docs

Basic XML types and accessor functions

type attr_list = (Base.string * Base.string) Base.list
val sexp_of_attr_list : attr_list -> Sexplib0.Sexp.t
val compare_attr_list : attr_list -> attr_list -> Base.int
val equal_attr_list : attr_list -> attr_list -> Base.bool
type element = {
  1. tag : Base.string;
  2. attrs : attr_list;
  3. text : Base.string;
  4. children : element Base.list;
}
val sexp_of_element : element -> Sexplib0.Sexp.t
val compare_element : element -> element -> Base.int
val equal_element : element -> element -> Base.bool

Convenience function to access attributes by name

val preserve_space : attr_list -> Base.bool

Convenience function to check whether an element has attribute xml:space="preserve"

val unescape : Base.string -> Base.string

SZXX.Xml.DOM.unescape "Fast & Furious 🏎️" returns "Fast & Furious 🏎️"

el |> dot "row" returns the first immediate <row> child of element el

el |> dot "row" returns the text of the first immediate <row> child of element el

val filter_map : Base.string -> f:(element -> 'a Base.option) -> element -> 'a Base.list

el |> filter_map "row" ~f returns all filtered f <row> children of element el

el |> at 3 returns the nth (0-based indexing) immediate child of element el.

Same as at but takes a string argument. This allows at_s to be used in get together with dot and dot_text

get el [dot "abc"; dot "def"] is equivalent to el |> dot "abc" |> Option.bind ~f:(dot "def") Convenience function to chain multiple dot and at calls to access nested elements.

OCaml

Innovation. Community. Security.