Module Ocamlduce.Load

module Load: sig .. end
Importing XML documents.

This module provides an abstract type of XML loaders. An XML parser can interact with such an object to produce an x-value. After creating the loader with the make function, the XML parser must call start_elem, end_elem and text for each corresponding event found in the input document. The loader object is responsible for XML Namespaces resolution. All the strings must be encoded in UTF-8.
type t 
The type of loader objects.
type anyxml = {{anyxml}} 
The type for the values produced by the loader.
exception Error of string
val make : ?ns:bool -> ?ns_table:Ocamlduce.NamespaceTable.t -> unit -> t
make ~ns () creates a fresh loader. If ns is true, the loader will attach a namespace bindings to each XML element. The ns_table can provide predefined namespace prefixes.
val get : t -> anyxml
get l is to be called when the whole XML document has been parsed. It returns the root element of the loaded XML documents, or raises Error if the document is not well-formed.
val start_elem : t -> string -> (string * string) list -> unit
start_elem l tag attr is to be called when the XML parser encounters the opening markup for an XML element with specified tag and attributes. The function raises Error if the same attribute label appears several times.
val end_elem : t -> 'a -> unit
end_element l x is to be called when the XML parser encounters the closing markup for an XML element.
val text : t -> string -> unit
text l txt is to be called when the XML parser encounters some textual data (PCDATA). It is legal to call text several times in a row.
val sub : t -> anyxml -> unit
sub l v inserts an already parsed XML element as a subtree.