package ocsigenserver

  1. Overview
  2. Docs
A full-featured and extensible Web server

Install

dune-project
 Dependency

Authors

Maintainers

Sources

6.0.0.tar.gz
md5=001e22ec2da3ab08840f934a8f005859
sha512=59f36fdf0a640117aa562d1d9ef96b7146843d9b72d71d01366640521405550074e03267fb388c5e685542781fc4bce763818a36cf05c0e033fae5e51c2f1496

doc/ocsigenserver/Ocsigen_extensions/Configuration/index.html

Module Ocsigen_extensions.ConfigurationSource

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

Sourcetype element

Specification of a XML element.

Sourcetype attribute

Specification of a XML attribute.

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

Create the specification of a XML element.

  • parameter name

    Name of the XML tag

  • parameter init

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

  • parameter obligatory

    Whether the element is obligatory (false by default)

  • parameter elements

    Specifications of the child elements

  • parameter attribute

    Specifications of the attributes

  • parameter pcdata

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

  • parameter other_elements

    Optional function to be applied on the content of unspecified tags

  • parameter other_attributes

    Optional function to be applied on the unspecfied attributes

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

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

  • parameter name

    The name of the XML attribute

  • parameter obligatory

    Whether the attribute is obligatory (false by default)

  • parameter f

    Function to be applied on the value string of the attribute

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

Process an XML element by the specifications.

  • parameter in_tag

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

  • parameter elements

    Specifications of the child elements

  • parameter pcdata

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

  • parameter other_elements

    Optional function to be applied on unexpected child elements

  • raises Error_in_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

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

Application of process_element on a list of XML elements.

Sourceval ignore_blank_pcdata : in_tag:string -> string -> unit

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

Sourceval refuse_pcdata : in_tag:string -> string -> unit