module Yaxposax:Provides a SAX-like interface, where the parser invokes user callbacks as it processes a document.sig
..end
type
xml_callbacks = {
|
start_element : |
|
characters : |
|
cdata : |
|
comment : |
|
pi : |
|
end_element : |
The callbacks are invoked in continuation-passing style (CPS). They are each passed an additional argument besides what you expect, a procedure of type (unit->unit)
. When your callback is finished processing, instead of returning control, it should issue a tail-call to this procedure.
val parse_element : #Cps_reader.t -> xml_callbacks -> (unit -> unit) -> unit
Cps_reader.t
, your callbacks, and a continuation. In most cases, you can use (fun () -> ())
for the continuation.U_char.Bad_char
if an invalid character is encountered.Utf8_char.Bad_encoding
if a UTF-8 decoding error occurs.Lex_error
if a lexical error is encountered.Parse_error
if a parsing error is encountered.val parse_document : #Cps_reader.t -> xml_callbacks -> (unit -> unit) -> unit
U_char.Bad_char
if an invalid character is encountered.Utf8_char.Bad_encoding
if a UTF-8 decoding error occurs.Lex_error
if a lexical error is encountered.Parse_error
if a parsing error is encountered, or if content comes in the wrong order.