Sys.getenv "HELM_STYLECONFIGURATION_PATH"
with
Not_found ->
- let tmp_filename = C.tmpdir ^ "/style-configuration.xml" in
- if Sys.file_exists tmp_filename then tmp_filename
- else begin
- let styleconf = Getter.raw_get "getstyleconf" in
- let out_channel = open_out tmp_filename in
- output_string out_channel styleconf;
- close_out out_channel;
- tmp_filename
- end
+ let xml = "style-configuration.xml" in
+ let tmp_xml = Configuration.tmp_dir ^ "/" ^ xml in
+ let request_xml = Configuration.getter_url ^ "getstyleconf?uri=" ^ xml in
+ ClientHTTP.get_and_save request_xml tmp_xml ;
+ tmp_xml
exception Warnings;;
let module Y = Pxp_yacc in
try
let config = {Y.default_config with Y.warner = new warner} in
- Y.parse_document_entity config (Y.from_file filename) Y.default_spec
+ Y.parse_document_entity config (PxpUriResolver.from_file filename) Y.default_spec
with
e ->
print_endline (Pxp_types.string_of_exn e) ;
Pxp_document.T_element "style" ->
let key =
try
- n#attribute "key"
+ match n#attribute "key" with
+ Pxp_types.Value s -> s
+ | _ -> raise Impossible
with
Not_found -> n#data
- Hashtbl.add styles key n#data
+ in
+ Hashtbl.add styles key n#data
| Pxp_document.T_element "apply" ->
let keys = List.map
(function n ->
match n#node_type with
- Pxp_document.T_element "style-ref" -> n#attribute "key"
+ Pxp_document.T_element "style-ref" ->
+ begin
+ match n#attribute "key" with
+ Pxp_types.Value s -> s
+ | _ -> raise Impossible
+ end
| _ -> raise Impossible
)
n#sub_nodes
in
- Hashtbl.add applies (n#attribute "name") keys
+ let apply_name =
+ match n#attribute "name" with
+ Pxp_types.Value s -> s
+ | _ -> raise Impossible
+ in Hashtbl.add applies apply_name keys
| _ -> raise Impossible
)
((xml_document ())#root#sub_nodes)
;;
let style_of_key key =
- Hashtbl.lookup styles key
+ Hashtbl.find styles key
let key_list_of_mode_name name =
- Hashtbl.lookup applies name
+ Hashtbl.find applies name
+;;
+