I''m using getclicky for my site statistics. They have a url I can use to get the number of users online. I found ways to parse an xml file if it is local, but how should i do this if is from another link like http://api.getclicky.com/stats/api3?site_id=37569&sitekey=9b4c03f7c213%20&type=visitors-online&output=xml ? I''m trying to get the number of users online from the link above. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 21 Feb 2009, at 18:10, Scott Kulik wrote:> > I''m using getclicky for my site statistics. They have a url I can use > to get the number of users online. I found ways to parse an xml > file if > it is local, but how should i do this if is from another link like > http://api.getclicky.com/stats/api3?site_id=37569&sitekey=9b4c03f7c213%20&type=visitors-online&output=xml > ? >Well it depends on how you are parsing your xml, but with REXML::Document all you need to do is get the xml into a string or an IO object, so for example you could use the net/http library to grab the data and then stick that into REXML::Document.new Fred> I''m trying to get the number of users online from the link above. > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Just a suggestion though, although the REXML api is really nice to use, I''d start with libxml. The speed difference is large enough to put up with the api being a little less intuitive. just my 2cents Simon On Sun, 22 Feb 2009 08:47:37 +0900, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 21 Feb 2009, at 18:10, Scott Kulik wrote: > >> >> I''m using getclicky for my site statistics. They have a url I can use >> to get the number of users online. I found ways to parse an xml >> file if >> it is local, but how should i do this if is from another link like >> http://api.getclicky.com/stats/api3?site_id=37569&sitekey=9b4c03f7c213%20&type=visitors-online&output=xml >> ? >> > Well it depends on how you are parsing your xml, but with > REXML::Document all you need to do is get the xml into a string or an > IO object, so for example you could use the net/http library to grab > the data and then stick that into REXML::Document.new > > Fred >> I''m trying to get the number of users online from the link above. >> -- >> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve just recently spent a week learning how to export data using the Builder::XMLMarkup. In effect I created this object and populated it with data from my Rails database and sent it flying with a send_data method. I''ve been reading how one then imports data and loads this into the Rails database with ActiveResource (Obie''s book). Is it something like this; 1. Create the resource as a model and the route to point to the controller action. 2. This action opens a REXML::Document.new ( which then does these three things) a. create .new record b. newrecord field = REXML::Document.fieldname, etc. c. newrecord.save Does anyone have examples of how they used an external XML file to import data into a Rails database ( and the routing used)? Thank you, David On Feb 21, 9:32 pm, "Simon Macneall" <macne...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Just a suggestion though, although the REXML api is really nice to use, I''d start with libxml. The speed difference is large enough to put up with the api being a little less intuitive. > > just my 2cents > > Simon > > On Sun, 22 Feb 2009 08:47:37 +0900, Frederick Cheung <frederick.che...@gmail.com> wrote: > > > On 21 Feb 2009, at 18:10, Scott Kulik wrote: > > >> I''m using getclicky for my site statistics. They have a url I can use > >> to get the number of users online. I found ways to parse an xml > >> file if > >> it is local, but how should i do this if is from another link like > >>http://api.getclicky.com/stats/api3?site_id=37569&sitekey=9b4c03f7c21... > >> ? > > > Well it depends on how you are parsing your xml, but with > > REXML::Document all you need to do is get the xml into a string or an > > IO object, so for example you could use the net/http library to grab > > the data and then stick that into REXML::Document.new > > > Fred > >> I''m trying to get the number of users online from the link above. > >> -- > >> Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---