I have XML file, here part of it:
<advcampaign_categories>
<category id="85">Sport</category>
<category id="79">Gifts</category>
<category id="87">Flowers</category>
etc..
</advcampaign_categories>
and try to parse it like this:
url = 'my_xml_str'
data = open(url).read
Hash.from_xml(data).each do |k, v|
v['advcampaign_categories'] ...
then it returns me:
{"category"=>
["Sport",
"Gifts",
"Flowers"]
}
So my question is how to get category_id
? if its possible or may be any other solutions?
Ideally, I want hash like this {sport:85,gifts:79}