(* internal functions *******************************************************)
-let obj_ext = ".ld.xml"
+let base = "xml"
-let system = "http://helm.cs.unibo.it/lambda-delta/xml/ld.dtd"
+let obj_ext = ".xml"
-let path_of_uri base uri =
+let system = "http://helm.cs.unibo.it/lambda-delta/" ^ base ^ "/ld.dtd"
+
+let path_of_uri uri =
F.concat base (Str.string_after (U.string_of_uri uri) 3)
let pp_head frm =
Format.fprintf frm "<?xml version=%S encoding=%S?>@,@," "1.0" "UTF-8"
let pp_doctype frm =
- Format.fprintf frm "<!DOCTYPE KERNEL SYSTEM %S>@,@," system
+ Format.fprintf frm "<!DOCTYPE ENTRY SYSTEM %S>@,@," system
-let open_kernel si g frm =
+let open_entry si g frm =
let opts = if si then "si" else "" in
let f shp =
- Format.fprintf frm "<KERNEL hierarchy=%S options=%S>" shp opts
+ Format.fprintf frm "<ENTRY hierarchy=%S options=%S>" shp opts
in
H.string_of_graph f g
-let close_kernel frm =
- Format.fprintf frm "</KERNEL>"
+let close_entry frm =
+ Format.fprintf frm "</ENTRY>"
(* interface functions ******************************************************)
-let export_item export_obj si g base = function
- | Some obj ->
- let _, uri, bind = obj in
- let path = path_of_uri base uri in
+let export_entity export_entry si g = function
+ | Some entry ->
+ let _, uri, bind = entry in
+ let path = path_of_uri uri in
let _ = Sys.command (Printf.sprintf "mkdir -p %s" (F.dirname path)) in
let och = open_out (path ^ obj_ext) in
let frm = Format.formatter_of_out_channel och in
Format.pp_set_margin frm max_int;
Format.fprintf frm "@[<v>%t%t%t%a%t@]@."
- pp_head pp_doctype (open_kernel si g) export_obj obj close_kernel;
+ pp_head pp_doctype (open_entry si g) export_entry entry close_entry;
close_out och
| None -> ()