I have an XML file containing data which I need to access in the controller. For example, the XML file contains cpu usage and cpu load and other such information. I need to collect this information into a controller and display it in a graph (chartdirector). How do I get the values from the XML file to the controller? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, Jan 18, 2010 at 8:08 AM, Sujay Benegal <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have an XML file containing data which I need to access in the > controller. For example, the XML file contains cpu usage and cpu load > and other such information. I need to collect this information into a > controller and display it in a graph (chartdirector). How do I get the > values from the XML file to the controller?Open the file and use Nokogiri (gem) to parse the XML. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Did you checkout the nokogiri plugin? Also there is ReXML On Mon, Jan 18, 2010 at 8:08 AM, Sujay Benegal <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have an XML file containing data which I need to access in the > controller. For example, the XML file contains cpu usage and cpu load > and other such information. I need to collect this information into a > controller and display it in a graph (chartdirector). How do I get the > values from the XML file to the controller? > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- Satyajit -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Where would you recommend putting all of the parsing code, in a Model or Controller? I''m very new at working with MVC, but to be it seems that an XML document, being a representation of data, would be handled by a Model. Am I wrong? Thanks! On Jan 18, 11:16 am, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Jan 18, 2010 at 8:08 AM, Sujay Benegal <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > I have an XML file containing data which I need to access in the > > controller. For example, the XML file contains cpu usage and cpu load > > and other such information. I need to collect this information into a > > controller and display it in a graph (chartdirector). How do I get the > > values from the XML file to the controller? > > Open the file and use Nokogiri (gem) to parse the XML. > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/1/18 Seirie <seirie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Where would you recommend putting all of the parsing code, in a Model > or Controller? I''m very new at working with MVC, but to be it seems > that an XML document, being a representation of data, would be handled > by a Model. Am I wrong? Thanks!You are completely correct, put the reading and parsing in a model that is not derived from AR::base Colin> > On Jan 18, 11:16 am, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On Mon, Jan 18, 2010 at 8:08 AM, Sujay Benegal <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> > I have an XML file containing data which I need to access in the >> > controller. For example, the XML file contains cpu usage and cpu load >> > and other such information. I need to collect this information into a >> > controller and display it in a graph (chartdirector). How do I get the >> > values from the XML file to the controller? >> >> Open the file and use Nokogiri (gem) to parse the XML. >> >> -- >> Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> twitter: @hassan > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.