package SZXX

  1. Overview
  2. Docs

Module Xml.DOMSource

Basic XML types and accessor functions

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

Convenience function to access attributes by name

Sourceval preserve_space : attr_list -> bool

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

Sourceval unescape : string -> string

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

Sourceval dot : string -> element -> element option

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

Sourceval dot_text : string -> element -> string option

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

Sourceval filter_map : string -> f:(element -> 'a option) -> element -> 'a list

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

Sourceval at : int -> element -> element option

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

Sourceval at_s : string -> element -> element option

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

Sourceval get : (element -> element option) list -> element -> element option

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.