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 Adding Messages - Typed Error Codes (Preferred)} *)
12
13(** Add a message from a typed error code. *)
14val add_typed :
15 t ->
16 ?location:Message.location ->
17 ?element:string ->
18 ?attribute:string ->
19 ?extract:string ->
20 Error_code.t ->
21 unit
22
23(** Add an error from a typed error code. Alias for add_typed. *)
24val add_error_code :
25 t ->
26 ?location:Message.location ->
27 ?element:string ->
28 ?attribute:string ->
29 ?extract:string ->
30 Error_code.t ->
31 unit
32
33(** {1 Adding Messages - Legacy (for migration)} *)
34
35(** Add a message to the collector. *)
36val add : t -> Message.t -> unit
37
38(** Add an error message to the collector (legacy). *)
39val add_error :
40 t ->
41 message:string ->
42 ?code:string ->
43 ?location:Message.location ->
44 ?element:string ->
45 ?attribute:string ->
46 ?extract:string ->
47 unit ->
48 unit
49
50(** Add a warning message to the collector (legacy). *)
51val add_warning :
52 t ->
53 message:string ->
54 ?code:string ->
55 ?location:Message.location ->
56 ?element:string ->
57 ?attribute:string ->
58 ?extract:string ->
59 unit ->
60 unit
61
62(** Add an info message to the collector (legacy). *)
63val add_info :
64 t ->
65 message:string ->
66 ?code:string ->
67 ?location:Message.location ->
68 ?element:string ->
69 ?attribute:string ->
70 ?extract:string ->
71 unit ->
72 unit
73
74(** {1 Retrieving Messages} *)
75
76(** Get all messages in the order they were added. *)
77val messages : t -> Message.t list
78
79(** Get only error messages. *)
80val errors : t -> Message.t list
81
82(** Get only warning messages. *)
83val warnings : t -> Message.t list
84
85(** Get only info messages. *)
86val infos : t -> Message.t list
87
88(** {1 Status Queries} *)
89
90(** Check if the collector contains any error messages. *)
91val has_errors : t -> bool
92
93(** Get the total number of messages. *)
94val count : t -> int
95
96(** Get the number of error messages. *)
97val error_count : t -> int
98
99(** {1 Modification} *)
100
101(** Clear all messages from the collector. *)
102val clear : t -> unit