module Pxp_event:Event streams and listssig
..end
val to_list : (unit -> Pxp_types.event option) -> Pxp_types.event list
val of_list : Pxp_types.event list -> unit -> Pxp_types.event option
val concat : (unit -> Pxp_types.event option) list -> unit -> Pxp_types.event option
val iter : (Pxp_types.event -> unit) -> (unit -> Pxp_types.event option) -> unit
val extract : Pxp_types.event ->
(unit -> Pxp_types.event option) -> unit -> Pxp_types.event option
next
prepended by e
.
A subexpression consists of either E_pinstr; E_start_tag; E_data; E_start_tag; E_end_tag;
E_comment; E_end_tag; E_data
;;
let g = of_list l;;
g();;
let Some e = g();; (* e = E_start_tag *)
let g' = extract e g;;
g'();; (* returns Some E_start_tag *)
...
g'();; (* returns Some E_end_tag *)
g'();; (* returns None, end of subexpression *)
g();; (* returns Some E_data *)
g();; (* returns None *)typefilter =
(unit -> Pxp_types.event option) -> unit -> Pxp_types.event option
val norm_cdata_filter : filter
val drop_ignorable_whitespace_filter : filter
entry
passed to the create_pull_parser
call. Furthermore,
there must be an E_start_doc event.
This filter does not perform any other validation checks.
val pfilter : (Pxp_types.event -> bool) -> filter
Example: Remove comments:
pfilter (function E_comment _ -> false | _ -> true) g
typedtd_style =
[ `Ignore | `Include | `Reference ]
val write_events : ?default:string ->
?dtd_style:dtd_style ->
?minimization:[ `AllEmpty | `None ] ->
Pxp_types.output_stream ->
Pxp_types.encoding ->
Pxp_types.rep_encoding -> (unit -> Pxp_types.event option) -> unit
output_stream
. The events must be encoded
as indicated by the rep_encoding
argument, but the output is written
as specified by the encoding
argument.
The normalized namespace prefixes are declared as needed. Additionally,
one can set the default namespace by passing default
, which must be
the normalized prefix of the default namespace.
For E_doc_start events, the DTD may be written. This is controlled by
dtd_style
:
~minimization
: How to write out empty elements. `AllEmpty
means that all empty elements are minimized (using the <name/>
form). `None
does not minimize at all and is the default.val display_events : ?dtd_style:dtd_style ->
?minimization:[ `AllEmpty | `None ] ->
Pxp_types.output_stream ->
Pxp_types.encoding ->
Pxp_types.rep_encoding -> (unit -> Pxp_types.event option) -> unit
output_stream
. The events must be encoded
as indicated by the rep_encoding
argument, but the output is written
as specified by the encoding
argument.
Namespace prefixes are declared as defined in the namespace scopes. Missing prefixes are invented on the fly.
The way the DTD is printed can be set as in write_events
.