+let v =
+ if (Filename.check_suffix !Options.input_file ".srx")
+ then
+ begin
+ Printf.eprintf "Loading from file : ";
+ time (Tree.Binary.load ~sample:!Options.sample_factor )
+ (Filename.chop_suffix !Options.input_file ".srx");
+ end
+ else
+ let v =
+ time (fun () -> let v = Tree.Binary.parse_xml_uri !Options.input_file;
+ in Printf.eprintf "Parsing document : %!";v
+ ) ()
+ in
+ if !Options.save_file <> ""
+ then begin
+ Printf.eprintf "Writing file to disk : ";
+ time (Tree.Binary.save v) !Options.save_file;
+ end;
+ v
+in
+ main v !Options.query !Options.output_file;;