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 44 45 46 47 48 49 50 51 52 53
|
(* $Id$
* ----------------------------------------------------------------------
*
*)
open Pxp_yacc
open Pxp_document
open Pxp_types
let conf =
{ default_config with
enable_pinstr_nodes = true;
enable_super_root_node = true;
enable_comment_nodes = true;
encoding = `Enc_iso88591;
};;
let conf' =
{ conf with
encoding = `Enc_utf8;
};;
let main() =
let doc = parse_document_entity
conf
(from_file "sample003.xml")
default_spec in
let out1 = open_out "sample003.xml.out1" in
doc # write (`Out_channel out1) `Enc_utf8;
close_out out1;
let doc' = Pxp_marshal.relocate_document doc conf' default_spec in
let out2 = open_out "sample003.xml.out2" in
doc' # write (`Out_channel out2) `Enc_utf8;
close_out out2;
assert(Sys.command "cmp sample003.xml.out1 sample003.xml.out2" = 0);
()
;;
try
main()
with
exn ->
prerr_endline("ERROR: " ^ string_of_exn exn);
exit 1
;;
|