let of_file fname =
let fh = open_in fname in
let xml = Xmlm.make_input ~enc:(Some `UTF_8) (`Channel fh) in
let scans = ref [] in
while not(Xmlm.eoi xml) do
match Xmlm.input xml with
| `El_start((_, "spectrum"), atts) ->
let id = int_of_string(attribute_exn "id" atts) in
(* retentionTime ? *)
let scan = { id; mslevel = 0; precursor = [];
mz = empty_vec; int = empty_vec; sup = [] } in
let scan = get_spectrum xml scan 0 in
scans := scan :: !scans
| _ -> ()
done;
!scans