X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Fpxp%2Fpxp%2Fexamples%2Fsimple_transformation%2Fprint.ml;fp=helm%2FDEVEL%2Fpxp%2Fpxp%2Fexamples%2Fsimple_transformation%2Fprint.ml;h=56f5fb69b5e9d18aed9e7375c10c852af84a04a3;hb=c03d2c1fdab8d228cb88aaba5ca0f556318bebc5;hp=0000000000000000000000000000000000000000;hpb=758057e85325f94cd88583feb1fdf6b038e35055;p=helm.git diff --git a/helm/DEVEL/pxp/pxp/examples/simple_transformation/print.ml b/helm/DEVEL/pxp/pxp/examples/simple_transformation/print.ml new file mode 100644 index 000000000..56f5fb69b --- /dev/null +++ b/helm/DEVEL/pxp/pxp/examples/simple_transformation/print.ml @@ -0,0 +1,60 @@ +(* $Id$ + * ---------------------------------------------------------------------- + * + *) + +(* Read a record-list structure and print it *) +open Pxp_types;; +open Pxp_document;; +open Pxp_yacc;; + +let print tree = + iter_tree + ~pre: + (fun n -> + match n # node_type with + T_element "last-name" -> + print_endline ("Last name: " ^ n # data) + | T_element "first-name" -> + print_endline ("First name: " ^ n # data) + | T_element "phone" -> + print_endline ("Telephone number: " ^ n # data) + | _ -> + ()) + ~post: + (fun n -> + match n # node_type with + T_element "record" -> + print_newline() + | _ -> + ()) + tree +;; + +let main() = + try + let dtd = parse_dtd_entity default_config (from_file "record.dtd") in + let tree = + parse_content_entity default_config (from_channel stdin) dtd default_spec in + print tree + with + x -> + prerr_endline(string_of_exn x); + exit 1 +;; + + +main();; + +(* ====================================================================== + * History: + * + * $Log$ + * Revision 1.1 2000/11/17 09:57:32 lpadovan + * Initial revision + * + * Revision 1.1 2000/08/22 21:57:43 gerd + * Initial revision. + * + * + *)