indexing description: "[ This is an XML filter used for reading the user settings. It reads name-value pairs into a hash table. ]" date: "$Date$" revision: "$Revision$" class EM_SETTINGS_READER_XM_FILTER inherit XM_CALLBACKS_FILTER redefine on_start, on_finish, on_error, on_start_tag, on_attribute, on_start_tag_finish, on_end_tag end create make_null feature -- Document on_start is -- Called when parsing starts. do create user_settings_table.make_default has_error := false end on_finish is -- Called when parsing finished. do if has_error then -- todo: what do do on error? debug io.put_string ("ERROR: Input file contains error. No output file generated%N") end end end feature -- Errors on_error (a_message: STRING) is -- Event producer detected an error. do has_error := true debug io.put_string ("Parse error:%N" + a_message + "%N") end end feature -- Tag on_start_tag (a_namespace: STRING; a_prefix: STRING; a_local_part: STRING) is -- Start of start tag. do current_tag := a_local_part end on_attribute (a_namespace: STRING; a_prefix: STRING; a_local_part: STRING; a_value: STRING) is -- Start of attribute. do if current_tag.as_lower.is_equal ("setting") then if a_local_part.as_lower.is_equal("name") then current_name := a_value elseif a_local_part.as_lower.is_equal("value") then current_value := a_value end end end on_start_tag_finish is -- End of start tag. do if current_name /= void and current_value /= void then user_settings_table.force (current_value, current_name) end current_tag := void current_name := void current_value := void end on_end_tag (a_namespace: STRING; a_prefix: STRING; a_local_part: STRING) is -- End tag. do end has_error: BOOLEAN current_tag: STRING current_name: STRING current_value: STRING user_settings_table: DS_HASH_TABLE[STRING, STRING] end