On Thu, Jan 5, 2012 at 5:08 AM, dabba dabba <harshadmehta / yahoo.com> wrote: > I have an xml structure like below and would like to store the activity > name attribute as key along with complete inputBindings structure with > xml tags etc as value in a hash - You should at least mention which XML parser you are using. > activityName = Hash.new > > Following doesn't get anything in value - > > xml.elements.each("/kp:process/kp:activity"){ |e| > @activityName[e.attributes["name"]] = You need to at least remove "@". You may also have to change attribute value extraction, depending on XML lib used. > xml.elements("/kp:process/kp:activity[@name=e.attributes["name"]]/kp:inputBindings > } Also, you might need to add XML namespace handling. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/