Module Ocsigen_extensions.​Configuration

module Configuration : sig..end

This modules contains types and constructor for the description of XML configurations and the accordingly parsing.


type element

Specification of a XML element.

type attribute

Specification of a XML attribute.

val element : 
  name:string ->
  ?obligatory:bool ->
  ?init:(unit -> unit) ->
  ?elements:element list ->
  ?attributes:attribute list ->
  ?pcdata:(string -> unit) ->
  ?other_elements:(string ->
   (string * string) list ->
   Simplexmlparser.xml list -> unit) ->
  ?other_attributes:(string -> string -> unit) ->
  unit -> element

Create the specification of a XML element.

name : Name of the XML tag

obligatory : Whether the element is obligatory (false by default)

init : A function to be executed before processing the child elements and attributes

elements : Specifications of the child elements

pcdata : Function to be applied on the pcdata (ignore_blank_pcdata by default)

other_elements : Optional function to be applied on the content of unspecified tags

other_attributes : Optional function to be applied on the unspecfied attributes

val attribute : 
  name:string ->
  ?obligatory:bool ->
  (string -> unit) -> attribute

attribute ~name f create a specification of a XML attribute.

name : The name of the XML attribute

obligatory : Whether the attribute is obligatory (false by default)

val process_element : 
  in_tag:string ->
  elements:element list ->
  ?pcdata:(string -> unit) ->
  ?other_elements:(string ->
   (string * string) list ->
   Simplexmlparser.xml list -> unit) ->
  Simplexmlparser.xml -> unit

Process an XML element by the specifications. Raises Error_in_user_config_file If an element (resp. attribute) occurs which is not specified by the element (resp. attribute) parameter and no function other_elements (resp. other_attributes) is provided

in_tag : Name of the enclosing XML tag (just for generating error messages)

elements : Specifications of the child elements

pcdata : Function to be applied on the PCDATA (ignore_blank_pcdata by default)

other_elements : Optional function to be applied on unexpected child elements

val process_elements : 
  in_tag:string ->
  elements:element list ->
  ?pcdata:(string -> unit) ->
  ?other_elements:(string ->
   (string * string) list ->
   Simplexmlparser.xml list -> unit) ->
  ?init:(unit -> unit) -> Simplexmlparser.xml list -> unit

Application of process_element on a list of XML elements.

val ignore_blank_pcdata : in_tag:string -> string -> unit

The specification for ignoring blank PCDATA ('\n', '\r', ' ', '\t') and failing otherwise (a reasonable default).