sssssssssssssss
tmp_path = File.dirname(__FILE__)
tmp_path = File.join(tmp_path,@path)
xml = REXML::Document.new(File.open(tmp_path))
@array = []
@total_str=[0,0,0,0,0]
@total_time =[0,0,0]
@total_hash = Hash.new
xml.elements.each("//Task") {|c|
@array << [1,c.attributes["Name"].to_ascii,c.attributes["Summary"].to_ascii,
c.attributes["UsedTime"].to_ascii]
tmpname = c.attributes["Name"]
tmptime = c.attributes["UsedTime"].to_ascii
tmpstr = c.attributes["Summary"].to_ascii
if tmptime.nil? || tmptime ==""
@total_time[0] = 0 + @total_time[0]
@total_time[1] = 0 + @total_time[1]
@total_time[2] = 0 + @total_time[2]
else
@total_time[0] = @total_time[0] + tmptime.split(":")[0].to_i
@total_time[1] = @total_time[1] + tmptime.split(":")[1].to_i
@total_time[2] = @total_time[2] + tmptime.split(":")[2].to_i
end
if tmpstr.nil? || tmpstr == ""
@total_str[0] = 0 + @total_str[0]
@total_str[1] = 0 + @total_str[1]
@total_str[2] = 0 + @total_str[2]
@total_str[3] = 0 + @total_str[2]
@total_str[4] = 0 + @total_str[2]
else
tmpstr_array = tmpstr.split(",")
@total_hash["1 #{tmpname.to_ascii}"] = [tmpstr_array[0].split(" ")[0].to_i,
tmpstr_array[1].split(" ")[0].to_i,
tmpstr_array[2].split(" ")[0].to_i,
tmpstr_array[3].split(" ")[0].to_i,
tmpstr_array[4].split(" ")[0].to_i]
@total_str[0] = @total_str[0] + tmpstr_array[0].split(" ")[0].to_i
@total_str[1] = @total_str[1] + tmpstr_array[1].split(" ")[0].to_i
@total_str[1] = @total_str[1] + tmpstr_array[2].split(" ")[0].to_i
@total_str[1] = @total_str[1] + tmpstr_array[3].split(" ")[0].to_i
@total_str[1] = @total_str[1] + tmpstr_array[4].split(" ")[0].to_i
end
c.elements.each{|b|
@array << [2,b.attributes["Name"].to_ascii,b.attributes["Summary"].to_ascii,
b.attributes["UsedTime"].to_ascii]
tmname1 = b.attributes["Name"]
tmstr1 = b.attributes["Summary"]
if tmstr1.nil? || tmstr1 == ""
else
tmstr_array1= tmstr1.split(",")
@total_hash["2 #{tmname1.to_ascii}"] = [tmstr_array1[0].split(" ")[0].to_i,
tmstr_array1[1].split(" ")[0].to_i,
tmstr_array1[2].split(" ")[0].to_i,
tmstr_array1[3].split(" ")[0].to_i,
tmstr_array1[4].split(" ")[0].to_i]
end
b.elements.each{ |a|
if a.attributes["LastResult"].to_ascii!="success"
@array << [3,a.attributes["Name"].to_ascii,a.attributes["LastResult"].to_ascii,
a.attributes["UsedTime"].to_ascii]
end
}
}
}
------解决方案--------------------
什么问题
[解决办法]
什么情况?好奇心会审死人的