indexing description: "DOM tree printer" project: "Project Goanna " library: "examples" date: "$Date$" revision: "$Revision$" author: "Glenn Maughan " copyright: "Copyright (c) 2001 Glenn Maughan and others" license: "Eiffel Forum Freeware License v1 (see forum.txt)." class PD inherit KL_SHARED_ARGUMENTS export {NONE} all end KL_INPUT_STREAM_ROUTINES export {NONE} all end creation make feature -- Initialization make is local node_impl: DOM_NODE_IMPL writer: DOM_WRITER factory: expanded DOM_TREE_BUILDER_FACTORY do -- check arguments parse_arguments if arguments_ok then parser := factory.create_parser parser.parse_from_file_name (file_name) -- print the tree node_impl ?= parser.document create writer writer.output(node_impl) else show_usage end end feature {NONE} -- Implementation parser: DOM_TREE_BUILDER arguments_ok: BOOLEAN -- Were the command line arguments parsed sucessfully? file_name: UC_STRING -- Name of file to parse. parse_arguments is -- Parse and validate the command line arguments local str: STRING file: like INPUT_STREAM_TYPE do if arguments.argument_count = 1 then str := arguments.argument (1) file := make_file_open_read (str) if is_open_read (file) then close (file) arguments_ok := True create file_name.make_from_string (str) end end end show_usage is -- Output usage message to user local str: STRING do create str.make_from_string ("Usage: pd ") print (str) end end -- class PD