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 -> Xml.xml list -> unit) ->
?other_attributes:(string -> string -> unit) ->
unit -> elementCreate the specification of a XML element.
name : Name of the XML tagobligatory : Whether the element is obligatory (false by default)init : A function to be executed before processing the child elements and attributeselements : Specifications of the child elementspcdata : Function to be applied on the pcdata (ignore_blank_pcdata by default)other_elements : Optional function to be applied on the content of unspecified tagsother_attributes : Optional function to be applied on the unspecfied attributesval attribute : name:string ->
?obligatory:bool ->
(string -> unit) -> attributeattribute ~name f create a specification of a XML attribute.
name : The name of the XML attributeobligatory : 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 -> Xml.xml list -> unit) ->
Xml.xml -> unitProcess an XML element by the specifications.
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 providedin_tag : Name of the enclosing XML tag (just for generating error messages)elements : Specifications of the child elementspcdata : Function to be applied on the PCDATA (ignore_blank_pcdata by default)other_elements : Optional function to be applied on unexpected child elementsval 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 -> unitApplication of process_element on a list of XML elements.
val ignore_blank_pcdata : in_tag:string -> string -> unitThe specification for ignoring blank PCDATA ('\n', '\r', ' ', '\t') and failing otherwise (a reasonable default).
val refuse_pcdata : in_tag:string -> string -> unit