4 let ns_rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
5 let ns_xsd = "http://www.w3.org/2001/XMLSchema"
6 (* and ns_sec = As2_vocab.Constants.ActivityStreams.ns_sec ^ "#" *)
7 let ns_a = "http://www.w3.org/2005/Atom" (* https://www.rfc-editor.org/rfc/rfc4287#section-2 *)
8 let ns_thr = "http://purl.org/syndication/thread/1.0" (* https://www.rfc-editor.org/rfc/rfc4685#section-2 *)
9 let ns_seppo = "http://seppo.mro.name/2023/ns#"
10 let ns_backoffice = "http://seppo.mro.name/2023/backoffice#"
11 let ns_rfc7033 = "urn:ietf:rfc:7033"
12 let ns_rfc7565 = "urn:ietf:rfc:7565"
13 let ns_as = As2_vocab.Constants.ActivityStreams.ns_as
14 let ns_xhtml = "http://www.w3.org/1999/xhtml"
16 (* for testing purpose only *)
17 let to_buf ?
(xsl
= None
) ?
(readme
= None
) ?
(indent
= None
) (x
: _
Xmlm.frag
) (dst
: Buffer.t
) =
19 (* TODO check syntax *)
20 Printf.bprintf dst
"<?%s %s?>\n" n v
in
21 piw "xml" "version=\"1.0\"";
23 | Some v
-> piw "xml-stylesheet" (Printf.sprintf
"type='text/xsl' href='%s'" v
)
26 | Some v
-> Printf.bprintf dst
"<!--%s-->\n" v
28 let o = Xmlm.make_output ~decl
:false ~indent
(`Buffer dst
) in
29 Xmlm.output_doc_tree
(fun x
-> x
) o (None
,x
)
32 assert (String.exists
(fun c
-> c
== '
"') n == false);
33 let w = output_string oc in
37 assert (String.exists (fun c -> c == '"'
) v
== false);
38 w " "; w k
; w "=\""; w v
; w "\""
42 let to_chan ?
(xsl
= None
) ?
(readme
= None
) ?
(indent
= None
) (x
: _
Xmlm.frag
) dst
=
43 pi dst
"xml" ["version","1.0"];
45 | Some v
-> pi dst
"xml-stylesheet" ["type","text/xsl"; "href",v
]
48 | Some v
-> Printf.fprintf dst
"<!--%s-->\n" v
50 let o = Xmlm.make_output ~decl
:false ~indent
(`Channel dst
) in
51 Xmlm.output_doc_tree
(fun x
-> x
) o (None
,x
)