Drying my code

I am parsing an xml result using Hpricot, amazing …
I have a serie of tags to be transformed as parameters, so I am
building Hash by looping on these tags , the resulting data is oK? but
I ma not sure that I wrote a dry code


if doc.search(‘response > error’).innerHTML.empty?
accountTypes = []
(doc/:accounttype).each do |accountType|
data = {}

data[:locale] =
(accountType/:localized/:locale/:code).innerHTML
data[:title] =
(accountType/:localized/:locale/:title).innerHTML

… # here is the loop over the elements
tags = {}
(accountType/:tag).each do |tag|
key = (tag/:name).innerHTML.to_s
value = (tag/:value).innerHTML.to_s
tags.store(key, value)
end
…# end of the loop , storing the data
data[:tags] = tags
accountTypes << data
end

Is this loop OK ?
tags = {}
(accountType/:tag).each do |tag|
key = (tag/:name).innerHTML.to_s
value = (tag/:value).innerHTML.to_s
tags.store(key, value)
end

thanks for you fedback