(* $Id$ * ---------------------------------------------------------------------- * *) open Pxp_document;; open Pxp_yacc;; open Pxp_types;; let error_happened = ref false;; let print_error e = print_endline (string_of_exn e) ;; class warner = object method warn w = print_endline ("WARNING: " ^ w) end ;; let parse debug wf iso88591 filename = try (* Parse the document: *) let parse_fn = if wf then parse_wfdocument_entity else let index = new hash_index in parse_document_entity ?transform_dtd:None ~id_index:(index :> 'ext index) in let doc = parse_fn { default_config with debugging_mode = debug; encoding = if iso88591 then `Enc_iso88591 else `Enc_utf8; idref_pass = true; warner = new warner } (from_file filename) default_spec in () with e -> (* Print error; remember that there was an error *) error_happened := true; print_error e ;; let main() = let debug = ref false in let wf = ref false in let iso88591 = ref false in let files = ref [] in Arg.parse [ "-d", Arg.Set debug, " turn debugging mode on"; "-wf", Arg.Set wf, " check only on well-formedness"; "-iso-8859-1", Arg.Set iso88591, " use ISO-8859-1 as internal encoding instead of UTF-8"; ] (fun x -> files := x :: !files) " usage: pxpvalidate [options] file ... - checks the validity of XML documents. See below for list of options.