eabhvee
eabhvee

Reputation: 161

Rails XML builder

I have controller action in my rails application to output XML which in turn is used to generate a FusionChart. I am using a builder template for generating XML. Below is the code that is in builder template.

xml = Builder::XmlMarkup.new  
xml.chart(:palette=>'2', ....) do  
 for item in @domain_data  
  xml.set(:label=>item[:domain],:value=>item[:emp_count])  
 end  
end

This code throws error in all the browsers. When I move the code to controller and use the below snippet,

xml = Builder::XmlMarkup.new  
    xml.chart(:palette=>'2', :ca...) do  
     for item in @domain_data  
   xml.set(:label=>item[:domain],:value=>item[:emp_count])  
 end  
end  
send_data xml, :type=>"text/xml"  

it works fine in Google Chrome/firefox etc but returns an empty file in Internet Explorer. Can somebody tell me what might be wrong here? Thanks in advance // Abhi

Upvotes: 0

Views: 1224

Answers (1)

Daniel O'Hara
Daniel O'Hara

Reputation: 13428

You've forgotten about an XML declaration:

xml.instruct!

Upvotes: 1

Related Questions