Commit 14407337 authored by Pietro Abate's avatar Pietro Abate

[r2003-10-24 09:37:18 by szach] ported to new schema implementation, commented...

[r2003-10-24 09:37:18 by szach] ported to new schema implementation, commented out validation for the
moment

Original author: szach
Date: 2003-10-24 09:37:18+00:00
parent dc2f28f1
......@@ -13,6 +13,8 @@
open Printf
open Pxp_document
open Schema_common
open Schema_types
exception Usage
......@@ -21,10 +23,17 @@ let debug = true
let debug_print s = if debug then prerr_endline s
let main () =
let schema_file = try Sys.argv.(1) with Invalid_argument _ -> raise Usage in
let schema_doc = Schema_xml.pxp_tree_of schema_file in
let schema_file =
try
(match Sys.argv.(1) with
| "--help" | "-help" -> raise Usage
| fname -> fname)
with Invalid_argument _ -> raise Usage
in
debug_print "Parsing schema document ...";
let schema = Schema_parser.parse_schema schema_doc in
let schema = Schema_parser.schema_of_file schema_file in
print_schema Format.std_formatter schema
(*
for i = 2 to Array.length Sys.argv - 1 do
let instance_stream = Schema_xml.pxp_stream_of_file Sys.argv.(i) in
let first_element_name =
......@@ -39,7 +48,7 @@ let main () =
let first_element_decl =
(try
List.find (fun (name,_,_) -> name = first_element_name)
schema.elt_decls
schema.elements
with Not_found ->
raise (XSI_validation_error (sprintf "No declaration found in schema \
for element '%s'" first_element_name)))
......@@ -57,6 +66,7 @@ let main () =
print_endline (sprintf "Validation error on '%s': %s" Sys.argv.(i) msg);
flush stdout)
done
*)
let _ =
try
......@@ -72,12 +82,7 @@ let _ =
| XSI_validation_error msg ->
prerr_endline ("Error validating instance document:\n" ^ msg);
exit 3
(* PROVE VARIE *)
(*
Types.Print.print Format.std_formatter Builtin_defs.pos_int; Format.fprintf Format.std_formatter "\n";
Types.Print.print Format.std_formatter Builtin_defs.non_neg_int; Format.fprintf Format.std_formatter "\n";
Types.Print.print Format.std_formatter Builtin_defs.neg_int; Format.fprintf Format.std_formatter "\n";
Types.Print.print Format.std_formatter Builtin_defs.non_pos_int; Format.fprintf Format.std_formatter "\n";
*)
| Pxp_types.At _ as exc ->
prerr_endline ("PXP error: " ^ Pxp_types.string_of_exn exc);
exit 4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment