+open Pxp_document
+open Pxp_types
+open Pxp_yacc
+
+let load_from =
+ let config = default_config in
+ let entry = `Entry_document [ `Extend_dtd_fully; `Parse_xml_decl ] in
+ fun fname ->
+ let document =
+ parse_wfdocument_entity config (from_file fname) default_spec
+ in
+ let fill_registry () =
+ document#root#iter_nodes (fun n ->
+ try
+ (match n#node_type with
+ | T_element "value" ->
+ let key = n#required_string_attribute "key" in
+ let value = n#data in
+ set ~key ~value
+ | _ -> ())
+ with exn ->
+ let (fname, line, pos) = n#position in
+ raise (Parse_error (fname, line, pos,
+ "Uncaught exception: " ^ Printexc.to_string exn)))
+ in
+ let backup = backup_registry () in
+ Hashtbl.clear registry;
+ try
+ fill_registry ()
+ with exn ->
+ restore_registry backup;
+ raise exn
+
+ (* DEBUGGING ONLY *)
+