def initialize(logger)
resource_element = REXML::Document.new(File.new(FILE_NAME), 'r').root
@update_summary = resource_element.get_elements('updateSummary').first.text
@caption_of_article_of_wiki = resource_element.get_elements('captionOfarticleOfWiki').first.text
@minimum_number_of_articles_for_calculating_depth =
resource_element.get_elements('minimumNumberOfArticlesForCalculatingDepth').first.text.to_i
@table_Infos = []
resource_element.get_elements('tableInfos/tableLabel').each do |label_element|
@table_Infos.push(
TableInfo.new(label_element.text,
label_element.attribute('orMore').to_s.to_i))
end
@page_header = resource_element.get_elements('pageHeader').first.text
@table_header = resource_element.get_elements('tableHeader').first.text
@table_column_attributes = []
attributes_element = resource_element.get_elements('tableColumnAttributes').first
@table_column_attributes.push(attributes_element.get_elements('rank').first.text)
@table_column_attributes.push(attributes_element.get_elements('description').first.text)
@table_column_attributes.push(attributes_element.get_elements('englishDescription').first.text)
@table_column_attributes.push(attributes_element.get_elements('link').first.text)
@table_column_attributes.push(attributes_element.get_elements('numberOfArticles').first.text)
@table_column_attributes.push(attributes_element.get_elements('numberOfPages').first.text)
@table_column_attributes.push(attributes_element.get_elements('numberOfEdits').first.text)
@table_column_attributes.push(attributes_element.get_elements('numberOfAdministrators').first.text)
@table_column_attributes.push(attributes_element.get_elements('numberOfUsers').first.text)
@table_column_attributes.push(attributes_element.get_elements('numberOfActiveUsers').first.text)
@table_column_attributes.push(attributes_element.get_elements('numberOfFiles').first.text)
@table_column_attributes.push(attributes_element.get_elements('depth').first.text)
@table_column_attributes.push(attributes_element.get_elements('score').first.text)
@table_column_attributes.size.times do |i|
if @table_column_attributes[i] == nil then
@table_column_attributes[i] = ''
end
end
@summary_table_header = resource_element.get_elements('summaryTableHeader').first.text
@footer = resource_element.get_elements('footer').first.text
@languages = Hash.new
resource_element.get_elements('languages').first.get_elements('language').each do |language_element|
language_element = LanguageOfResource.new(language_element)
if (@languages.has_key?(language_element.code)) then
logger.log('リソースファイル中の言語コード "' + language_element.code + '" が重複しています。中断します。')
exit(1)
end
@languages.store(language_element.code, language_element)
end
end