<commit_before>open Syndic.Opml1
open Printf

(* let () = *)

(*   Printexc.record_backtrace true; *)

(*   try let _ = Atom.parse (Xmlm.make_input (`Channel stdin)) in () *)
(*   with *)
(*     | Atom.Error.Error (pos, err) -> *)
(*         print_endline err *)
(*     | _ -> Printexc.print_backtrace stderr *)

let iter_opt o f =
  match o with
  | None -> ()
  | Some x -> f x

let print_head h =
  printf "Title : %s\n" h.title;
  iter_opt h.date_created (fun d -> printf "Date Creation : %f\n"
                                        (CalendarLib.Calendar.to_unixfloat d));
  printf "Date Modified : %f\n"
         (CalendarLib.Calendar.to_unixfloat h.date_modified);
  printf "Name %s\n" h.owner_name;
  printf "Email %s\n" h.owner_email;
  printf "Expansion State [%s]\n"
         (String.concat ", " (List.map string_of_int h.expansion_state));
  iter_opt h.window_top (fun i -> printf "Window Top %d\n" i);
  iter_opt h.window_left (fun i -> printf "Window Left %d\n" i);
  iter_opt h.window_bottom (fun i -> printf "Window Bottom %d\n" i);
  iter_opt h.window_right (fun i -> printf "Window Right %d\n" i)

let rec print_outline level o =
  printf "%s Text %s\n" level o.text;
  List.iter (print_outline "Sub") o.outlines

let print_body b =
  List.iter (print_outline "High") b

let print_opml1 o =
  printf "Version : %s\n" o.version;
  print_head o.head;
  print_body o.body

let () =
  Printexc.record_backtrace true;

  try let o = parse (Xmlm.make_input (`Channel stdin)) in print_opml1 o
  with
  | Error.Error (pos, err) ->
    print_endline err
  | _ -> Printexc.print_backtrace stderr<commit_msg>Try new W3C Feed Validator parser<commit_after>open Syndic

let () =

  Printexc.record_backtrace true;

  try let lst = W3C.parse (Xmlm.make_input (`Channel stdin)) in
      List.iter
        (fun (_, err) -> Printf.printf "E: %s\n%!" err)
        (List.map Syndic.W3C.to_error lst)
  with
    | W3C.Error.Error ((l, c), err) ->
      Printf.printf "[%d;%d]: %s\n%!"
        l c err
    | _ -> Printexc.print_backtrace stderr
{'fraction_non_alphanumeric': 0.14152791380999022, 'fraction_numerical': 0.0034280117531831538, 'mean_word_length': 2.8186915887850468, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6831292', 'n_tokens_mistral': 776, 'n_tokens_neox': 767, 'n_words': 203}