In a previous post I showed how to convert a betternestedset full_set into a JSON hierarchy that you might feed to a javascript or flash component. Another thing you might want to do is to massage the data into an XML hierarchy to feed a ... javascript or flash component. Now you could use similar code to the previous example and build the XML document up with REXML or another XML library and be done with it. You may, however, want to avoid using such an XML library to avoid the speed penalty that comes with it. Here is an example of converting the content returned from full_set into an XML document without using an XML library:
hi, im a newbie in rails but in would like to utilize ur method. could u help me? my question is how to get that xml file back from the browser?
ReplyDeletehiow is that connected to the view? could u give a whole example? thx so much!
tomabroad@gmail.com
best tom
Sure Tom how about an action like this:
ReplyDeletedef some_action
@message = Message.find(params[:id])
respond_to do |format|
format.html {}
format.xml {
render :xml => @message.full_xml
}
end
end
That is assuming that a request expecting XML wants this full XML result.