Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Create an XML "file" in memory
7 Posts
Create an XML "file" in memory

Raul Rubio I pass The xml in this formet


Xml Start

Reporting screenshot from Mint http://www.haveamint.com


xml End to show the videos i write this in my public folder but i want to pass images and link from my database so how i have to do Thanks Amit Agarwal

Hi i create the xml file in my public folder and i want to pass some value from my database so i will do this. Thanks Amit Agarwal

Please provide some more info about how you are using the xml. Is there a flash object looking for a file somewhere or is there some other situation going on here?

hi i want to pass a list of playlist in my video so i have used xml for this but it did not reflect any thing on that so how i can do that Thanks Amit Agarwal

Thanks for the reply. I figured it out. But here's my code and solution.

My partial looks like this:

In the javascript, the parameter called 'xml:' is where you specify the path to the xml file spelling out the image paths you want to show. Previously I was using send_data to stream a file straight to that parameter but it was just rendering in the browser. But it expects a path to a file. So I created a controller action that triggers the xml send_data method and using url_for, all is well.

I hope this was clear enough to help someone else.

It depends on what your partial is doing. If your partial expects a params like hash, you could use Hash.from_xml to parse the XML and turn it into a Hash. Otherwise, please post the details of the partial.

I have a Flash gallery object that takes an xml file as a parameter to load the images. Creating the xml file is not a problem, I already handled that. My problem is that I have a bunch of these galleries all over my site and the XML is created dynamically from my database and I don't want to have to worry about reading/writing/updating a bunch of xml files for this purpose. First, I think it will unnecessarily slow. Second, I have to worry about deleting and recreating the xml files to keep them up to date, different file names for everything, etc., etc.

Can I create a file named "gallery.xml" in memory and pass it into my partial's javascript to fill in the param? An xml string doesn't work. Already tried it. I also tried using send_data like this:

send_data stream, :filename => 'gallery.xml', :type => 'text/xml', :disposition => 'inline

but that just returns the (properly formatted) xml back to the browser.

7 Posts
Login to add your message