package csvfields

  1. Overview
  2. Docs

Automatic conversion of OCaml field types into XML. This is used for excel communication functions

type xml

Abstract representation of the xml type

module type Xmlable = sig ... end

The functions provided by the with xml camlp4 extension, and that need to be provided in a hand made conversion to be used by the extension.

val to_string : xml -> string

Basic conversions

val to_string_fmt : xml -> string
val to_human_string : xml -> string
module Parser_state : sig ... end
val stateful_of_string : Parser_state.t -> string -> xml

Thread safe provided each thread uses a different Parser_state.t

val of_file : string -> xml
val tag : xml -> string option

Basic traversal

val attributes : xml -> (string * string) list
val children : xml -> xml list
val contents : xml -> string option
val child : xml -> string -> xml option
val kind : xml -> [ `Leaf | `Internal ]
val xml_data : string -> xml
exception Illegal_atom of xml

Exceptions that could be raised by to_xml and of_xml

exception Unexpected_xml of xml * string
val check_extra_fields : xml -> string list -> unit
  • raises Unexpected_xml,

    Illegal_atom Used by the with xml extension

XSD definition functions

val complex_type : xml list -> xml

An xsd complexType.

val decomplexify : xml list -> xml
val decomplexify_opt : xml list -> xml option
val decomplexify_list : xml list -> xml list option
val type_of_simple : xml list -> string
val wrap : xml -> xml

Standard wrapping to generate the necessary namespaces that are used in the automated conversions

module Restriction : sig ... end

Restriction generation

val xsd_element : ?attr:(string * string) list -> name:string -> xml list -> xml
val xml_element : ?attr:(string * string) list -> name:string -> xml list -> xml
module type Atom = sig ... end
module Make (Atom : Atom) : Xmlable with type t := Atom.t
val to_xml : to_string:('a -> string) -> 'a -> xml list

Helper functions to create the conversion functions by hand

val of_xml : of_string:(string -> 'a) -> xml -> 'a
val create_node : tag:string -> body:xml list -> xml

Creating an internal element in the xml tree

val create_data : string -> xml

Creating a leaf in the xml tree

type 'a of_xml = xml -> 'a

Conversion functions used by the camlp4 extension. Not to be used by hand

val unit_of_xml : unit of_xml
val bool_of_xml : bool of_xml
val string_of_xml : string of_xml
val char_of_xml : char of_xml
val int_of_xml : int of_xml
val float_of_xml : float of_xml
val int32_of_xml : Core.Int32.t of_xml
val int64_of_xml : Core.Int64.t of_xml
val nativeint_of_xml : Core.Nativeint.t of_xml
val big_int_of_xml : Big_int.big_int of_xml
val nat_of_xml : Nat.nat of_xml
val num_of_xml : Num.num of_xml
val ratio_of_xml : Ratio.ratio of_xml
val list_of_xml : ?tag:string -> (xml -> 'a) -> 'a list of_xml
val array_of_xml : tag:string -> (xml -> 'a) -> 'a array of_xml
val option_of_xml : tag:string -> (xml -> 'a) -> 'a option of_xml
val ref_of_xml : (xml -> 'a) -> 'a Core.ref of_xml
val lazy_t_of_xml : (xml -> 'a) -> 'a Core.Lazy.t of_xml
val recursive_of_xml : string -> (xml -> 'a) -> 'a of_xml
type 'a to_xml = 'a -> xml list
val xml_of_unit : unit to_xml
val xml_of_bool : bool to_xml
val xml_of_string : string to_xml
val xml_of_char : char to_xml
val xml_of_int : int to_xml
val xml_of_float : float to_xml
val xml_of_int32 : Core.Int32.t to_xml
val xml_of_int64 : Core.Int64.t to_xml
val xml_of_nativeint : Core.Nativeint.t to_xml
val xml_of_big_int : Big_int.big_int to_xml
val xml_of_nat : Nat.nat to_xml
val xml_of_num : Num.num to_xml
val xml_of_ratio : Ratio.ratio to_xml
val xml_of_ref : ('a -> xml list) -> 'a Core.ref to_xml
val xml_of_lazy_t : ('a -> xml list) -> 'a Core.Lazy.t to_xml
val xml_of_list : tag:string -> ('a -> xml list) -> 'a list to_xml
val xml_of_array : tag:string -> ('a -> xml list) -> 'a array to_xml
val xml_of_option : tag:string -> ('a -> xml list) -> 'a option to_xml
type to_xsd = xml list
val xsd_of_unit : to_xsd
val xsd_of_bool : to_xsd
val xsd_of_string : to_xsd
val xsd_of_char : to_xsd
val xsd_of_int : to_xsd
val xsd_of_float : to_xsd
val xsd_of_int32 : to_xsd
val xsd_of_int64 : to_xsd
val xsd_of_nativeint : to_xsd
val xsd_of_big_int : to_xsd
val xsd_of_list : string -> to_xsd -> to_xsd
val xsd_of_array : string -> to_xsd -> to_xsd
val xsd_of_nat : to_xsd
val xsd_of_num : to_xsd
val xsd_of_ratio : to_xsd
val xsd_of_ref : to_xsd -> to_xsd
val xsd_of_lazy_t : to_xsd -> to_xsd
val xsd_of_option : string -> to_xsd -> to_xsd
module type X = sig ... end
module Write (X : X) : sig ... end
OCaml

Innovation. Community. Security.