Processing an XML list in a controller

Hi

I have posted an XML list to a rails controller from a flex client along the lines of <itemList>     <item id="1" title="title one" value="6" />     <item id="5" title="title five " value="2" />     <item id="7" title="title blah blah" value="7" /> </itemList>

The itemList is a parmeter passed to the controller, what I would like to know is how I process the itemList as an XML entity. What I want to do is loop through the items, find the object for the id and update the value attribute based on the value from the XML list.

Is there an example around of doing a similar thing or if someone can provide an answer I would much appreciate it.

Hi,

Hi

thnkas for the responses, I have tried to prgress this by using REXML, and I have tried creating an REXL doc using

doc = REXML::Document.new ranking

where ranking is a variable that I have assigned from the paramters submitted to my controller, the parameters shown in the log as follows:

Parameters: {"ranking"=>{"asset"=>[{"title"=>"title one", "id"=>"1", "rank"=>"1"},              {"title"=>"title two", "id"=>"2", "rank"=>"2"},              {"title"=>"title fourteen ", "id"=>"14", "rank"=>"3"},

           .......              {"title"=>"title xxxxx", "id"=>"3", "rank"=>"12"},              {"title"=>"title yyyyyy", "id"=>"10", "rank"=>"13"}]},              "_method"=>"put", "action"=>"ranking", "path_prefix"=>"/ demo", "controller"=>"assets"}

As a result of the Document.new I get the following error

NameError (undefined local variable or method `source' for REXML::SourceFactory:Class):     c:/ruby/lib/ruby/1.8/rexml/source.rb:20:in `create_from'     c:/ruby/lib/ruby/1.8/rexml/parsers/baseparser.rb:130:in `stream='     c:/ruby/lib/ruby/1.8/rexml/parsers/baseparser.rb:107:in `initialize'     c:/ruby/lib/ruby/1.8/rexml/parsers/treeparser.rb:8:in `new'     c:/ruby/lib/ruby/1.8/rexml/parsers/treeparser.rb:8:in `initialize'

I have tried various options but can't seem to get round this. I assume I am having this problem as REXML does not recoginise the input to the new constructor as XML.

If anyone can shed any light on this I would much appreciate it.

cheers, G

If that's actually what's in params, somebody's already parsed the XML. No REXML needed...

--Matt