package xtmpl
Module Xtmpl.TypesSource
Base types and functor to create XML documents.
Locations
A position in a source (file, string, ...).
loc loc_start loc_stop creates a loc structure with the given positions.
loc_of_pos p len creates a loc structure with starting at position p and ending at position p + len. We aware that only the pos_cnum field is modified in the ending position.
val loc_sprintf :
(Lexing.position * Lexing.position) option ->
('a, unit, string) format ->
'aErrors
Documents
module Make
(P : P) :
S
with type name = P.Attributes.key
and type attr_value = P.attr_value
and type attributes = P.attr_value P.Attributes.t
and type data = P.datamerge_cdata c1 c2 returns a new cdata by merging text of the ones provided. If both have a location, the returned cdata has a location, ranging from the start position of the first to the end position of the second. If any of the cdatas has its quoted flag set to true, then the new cdata has this flag set to true.
Mapping trees
type ('n1, 'av1, 'a1, 'd1, 'n2, 'av2, 'a2, 'd2) map_param = {map_name : 'n1 -> 'n2;(*mapping names
*)map_attr_value : 'av1 -> 'av2;(*mapping attribute values
*)map_attributes : ('a1 -> 'a2) option;(*mapping attributes; if provided attributes will be mapped by this function; else
*)map_nameandmap_attr_valuewill be used for mapping each pair (name, value) of attributes.map_data : 'd1 -> 'd2;(*mapping data
*)
}Description of how to map various types in trees
type ('a1, 'x1, 'd1, 'p1, 'a2, 'x2, 'd2, 'p2) mapper = {map_atts : 'a1 -> 'a2;(*map attributes
*)map_xml : 'x1 -> 'x2;(*map a single tree
*)map_xmls : 'x1 list -> 'x2 list;(*map a list of trees
*)map_doc : 'd1 -> 'd2;(*map a whole document
*)map_prolog : 'p1 -> 'p2;(*map prolog of a document
*)
}The functions to map trees and documents, obtained with Make_map.mapper.