OCaml HTML5 parser/serialiser based on Python's JustHTML
1(** Message collector for accumulating validation messages. *)
2
3(** The type of a message collector. *)
4type t
5
6(** {1 Creation} *)
7
8(** Create a new empty message collector. *)
9val create : unit -> t
10
11(** {1 Current Location Tracking} *)
12
13(** Set the current location that will be used for messages without explicit location.
14 This is typically called by the DOM walker before invoking checker callbacks. *)
15val set_current_location : t -> Message.location option -> unit
16
17(** Clear the current location. *)
18val clear_current_location : t -> unit
19
20(** Get the current location. *)
21val get_current_location : t -> Message.location option
22
23(** {1 Adding Messages} *)
24
25(** Add a message to the collector. *)
26val add : t -> Message.t -> unit
27
28(** Add a message from a typed conformance error code.
29 Uses the current location if no explicit location is provided. *)
30val add_typed :
31 t ->
32 ?location:Message.location ->
33 ?element:string ->
34 ?attribute:string ->
35 ?extract:string ->
36 Error_code.t ->
37 unit
38
39(** {1 Retrieving Messages} *)
40
41(** Get all messages in the order they were added. *)
42val messages : t -> Message.t list
43
44(** Get only error messages. *)
45val errors : t -> Message.t list
46
47(** Get only warning messages. *)
48val warnings : t -> Message.t list
49
50(** Get only info messages. *)
51val infos : t -> Message.t list
52
53(** {1 Status Queries} *)
54
55(** Check if the collector contains any error messages. *)
56val has_errors : t -> bool
57
58(** Get the total number of messages. *)
59val count : t -> int
60
61(** Get the number of error messages. *)
62val error_count : t -> int
63
64(** {1 Modification} *)
65
66(** Clear all messages from the collector. *)
67val clear : t -> unit