Simple example of fetching data from url and then parsing returned XML

I would like to fetch some database info. I have to construct a url with
arguments, send it then parse the returned XML.

I quick example would be nice, but if someone could point out how to do
the
following tasks, I could probable figure it out.

  1. Performng a http ‘fetch’

  2. Parking XML. There must me a library or gem for this…

Thanks,

Joe

On 29 May 2015 at 18:44, [email protected] [email protected] wrote:

I would like to fetch some database info. I have to construct a url with
arguments, send it then parse the returned XML.

I quick example would be nice, but if someone could point out how to do the
following tasks, I could probable figure it out.

  1. Performng a http ‘fetch’

Is this to run as a background task or from the command line or from a
user request to a rails app?

  1. Parking XML. There must me a library or gem for this…

I assume you mean parsing :slight_smile: Have a look at nokigiri. In fact I
believe that will fetch it from a url for you. The answer to question
1 is still important as it is not advisable to run code fetching from
a url in a request from a user. No doubt when you googled for ruby
xml parsers you found others, they may well be perfectly acceptable
but I have not tried any of them.

Colin