package SZXX

  1. Overview
  2. Docs
type element = {
  1. tag : string;
  2. attrs : attr_list;
  3. text : string;
  4. children : element array;
}
val sexp_of_element : element -> Sexplib0.Sexp.t
val dot : string -> element -> element option

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

val dot_text : string -> element -> string option

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

val filter_map : string -> f:(element -> 'a option) -> element -> 'a array

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

val at : string -> element -> element option

el |> at "3" returns the nth (0-based indexing) immediate child of element el. The first argument is a string.

val get : element -> (element -> element option) list -> 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 nodes.

OCaml

Innovation. Community. Security.