From: Kouhei Sutou Date: 2002-10-30T16:53:14+09:00 Subject: Re: REXML Hi, From: "Matthew, Graeme" Subject: REXML Date: Wed, 30 Oct 2002 12:02:02 +0900 Message-ID: > Here is the request xml > > > > 1 > 2 > 1,2,3,4,5 > 31/12/2001 > 31/12/2002 > > > > the above is assigned to the xmlSent variable > the criteria is where I cannot get it to work > > what I want to do is get all the elements for and add them into > the hash > for example: > > object['criteria']['market'] = '1' > object['criteria']['benchmark'] = '1' > object['criteria']['manager'] = '1,2,3,4,5' What about this? rq = (Document.new xmlSent).root if rq.elements.size == 1 then object['type'] = rq.attributes['type'] object['value'] = rq.attributes['value'] object['criteria'] = {} rq.elements['criteria'].each_element do |element| object['criteria'][element.name] = element.text end end Regards, ====================== Kouhei Sutou kou@cneti.net