Sign in to follow this  
amairme

Invalid XML Data

Recommended Posts

I'm trying the FusionCharts Basic Database Example but i'm getting an error Invalid XML Data

 

Rails -v 2.1.1

 

here is my code:

 

<% @page_title="FusionCharts - Database Example" %>

 

<% @page_heading="FusionCharts Database Example Using dataXML method" %>

 

<% @page_subheading="Click on any pie slice to slice it out. Or, right click to enable rotation mode." %>

 

<%str_xml = render "process_utilizations/basic_factories_quantity",{:factory_data => @factory_data}

 

render_chart '/FusionCharts/Pie3D.swf', '', str_xml, 'FactorySum', 600, 300, false, false do-%>

 

<% end-%>

 

-------------------------

 

xml = ::Builder::XmlMarkup.new

 

xml.chart(:caption=>'Factory Output report', :subCaption=>'By Quantity', :pieSliceDepth=>'30', :showBorder=>'1', :formatNumberScale=>'0', :numberSuffix=>'Units') do

 

for item in factory_data

 

xml.set(:label=>item[:factory_name],:value=>item[:factory_output])

 

end

 

end

 

--------------------------

 

def basic_dbexample

 

headers["content-type"]="text/html";

 

@factory_data = []

 

factory_masters = FactoryMaster.find(:all)

 

factory_masters.each do |factory_master|

 

total = 0

 

factory_id = factory_master.id

 

factory_name = factory_master.name

 

factory_master.factory_output_quantities.each do |factory_output|

 

total += factory_output.quantity.to_i

 

end

 

@factory_data<<{:factory_name=>factory_name,:factory_output=>total}

 

end

 

end

 

---------------------

Share this post


Link to post
Share on other sites

The statement in the builder:

for item in factory_data

implies that the factory_data has to be sent as parameter to the builder. I hope that you are passing this value from basic_dbexample.html.erb

Edited by Guest

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this