开发者

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


You've forgotten about an XML declaration:

xml.instruct!
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜