File: testrss.ml

package info (click to toggle)
mldonkey 3.0.3-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 17,124 kB
  • ctags: 27,135
  • sloc: ml: 146,511; cpp: 11,802; ansic: 7,701; sh: 4,039; asm: 3,870; xml: 1,092; perl: 102; makefile: 101
file content (43 lines) | stat: -rw-r--r-- 2,373 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(*********************************************************************************)
(*                OCaml-RSS                                                      *)
(*                                                                               *)
(*    Copyright (C) 2003 Institut National de Recherche en Informatique et       *)
(*    en Automatique. All rights reserved.                                       *)
(*                                                                               *)
(*    This program is free software; you can redistribute it and/or modify       *)
(*    it under the terms of the GNU General Public License as published by       *)
(*    the Free Software Foundation; either version 2 of the License, or          *)
(*    any later version.                                                         *)
(*                                                                               *)
(*    This program is distributed in the hope that it will be useful,            *)
(*    but WITHOUT ANY WARRANTY; without even the implied warranty of             *)
(*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *)
(*    GNU General Public License for more details.                               *)
(*                                                                               *)
(*    You should have received a copy of the GNU General Public License          *)
(*    along with this program; if not, write to the Free Software                *)
(*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                   *)
(*    02111-1307  USA                                                            *)
(*                                                                               *)
(*    Contact: Maxence.Guesdon@inria.fr                                          *)
(*********************************************************************************)

let main () =
  if Array.length Sys.argv < 2 then
    (
     Printf.eprintf "usage: %s <file to parse>\n" Sys.argv.(0);
     exit 1
    );
  try
    let ch = Rss.channel_of_file Sys.argv.(1) in
    Rss.print_channel Format.std_formatter ch;
    print_newline ()
  with
    Xml.Error e ->
      prerr_endline (Xml.error e);
      exit 1
  | Xml_dtd.Parse_error e ->
      prerr_endline (Xml_dtd.parse_error e);
      exit 2

let _ = main ()