File: performance_xmlm.ml

package info (click to toggle)
ocaml-markup 1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,340 kB
  • sloc: ml: 15,131; makefile: 89
file content (20 lines) | stat: -rw-r--r-- 549 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(* This file is part of Markup.ml, released under the MIT license. See
   LICENSE.md for details, or visit https://github.com/aantron/markup.ml. *)

open Performance_common
open Xmlm

let (|>) x f = f x

let parse file =
  try
    make_input ~entity:(fun _ -> Some "") (`Channel (open_in file))
    |> input_doc_tree ~el:(fun _ _ -> ()) ~data:ignore
    |> ignore
  with Xmlm.Error ((l, c), e) as exn ->
    Printf.printf "%i %i %s\n" l c (error_message e);
    raise exn

let () =
  measure 100 "xmlm" xml_spec "xml" (fun () ->
    parse xml_spec)