My agentic slop goes here. Not intended for anyone else!
1module XML : sig
2 type t = Syndic_xml.t
3 type node = Syndic_xml.pos * Syndic_xml.tag * t list
4
5 val generate_catcher :
6 ?namespaces:string list
7 -> ?attr_producer:(string * (xmlbase:Uri.t option -> string -> 'a)) list
8 -> ?data_producer:(string * (xmlbase:Uri.t option -> node -> 'a)) list
9 -> ?leaf_producer:(xmlbase:Uri.t option -> Xmlm.pos -> string -> 'a)
10 -> (pos:Xmlm.pos -> 'a list -> 'b)
11 -> xmlbase:Uri.t option
12 -> node
13 -> 'b
14
15 val dummy_of_xml :
16 ctor:(xmlbase:Uri.t option -> string -> 'a)
17 -> xmlbase:Uri.t option
18 -> node
19 -> 'a
20
21 val xmlbase_of_attr :
22 xmlbase:Uri.t option -> Xmlm.attribute list -> Uri.t option
23end
24
25module Util : sig
26 val find : ('a -> bool) -> 'a list -> 'a option
27 val recursive_find : (XML.t -> bool) -> XML.t -> XML.t option
28 val filter_map : 'a list -> ('a -> 'b option) -> 'b list
29 val take : 'a list -> int -> 'a list
30 val tag_is : Xmlm.tag -> string -> bool
31 val attr_is : Xmlm.attribute -> string -> bool
32 val datas_has_leaf : XML.t list -> bool
33 val get_leaf : XML.t list -> string
34 val get_attrs : Xmlm.tag -> Xmlm.attribute list
35 val get_value : Xmlm.attribute -> string
36 val get_attr_name : Xmlm.attribute -> string
37 val get_tag_name : Xmlm.tag -> string
38 val only_whitespace : string -> bool
39
40 (** {2 Helpers to output XML} *)
41
42 val dummy_pos : Xmlm.pos
43 (** A dummy position when generating XML files. *)
44
45 val add_attr :
46 Xmlm.name -> string option -> Xmlm.attribute list -> Xmlm.attribute list
47
48 val add_attr_uri :
49 Xmlm.name -> Uri.t option -> Xmlm.attribute list -> Xmlm.attribute list
50
51 val tag : string -> Xmlm.tag
52 (** [tag n] returns a tag with name [n], no namespace, and no attributes. *)
53
54 val node_data : Xmlm.tag -> string -> XML.t
55 (** [node_data tag content] returns a node named [tag] with data set to
56 [content]. *)
57
58 val node_uri : Xmlm.tag -> Uri.t -> XML.t
59 val add_node_data : Xmlm.tag -> string option -> XML.t list -> XML.t list
60 val add_node_uri : Xmlm.tag -> Uri.t option -> XML.t list -> XML.t list
61
62 val add_nodes_rev_map : ('a -> XML.t) -> 'a list -> XML.t list -> XML.t list
63 (** [add_nodes_rev_map f l nodes] apply [f] to each element of [l] and add
64 the resulting HTML trees in reverse order in front of [nodes]. *)
65
66 val add_node_option : ('a -> XML.t) -> 'a option -> XML.t list -> XML.t list
67 (** [add_node_option f o nodes]: if [o] is [None], return [nodes]; otherwise
68 apply [f] to the value carried by [o] and add the resulting XML tree in
69 front of [nodes]. *)
70end