XML on a external website

In my rails application i want to fetch an external xml file

So my website www.test.com needs an xml file from
www.example.com/xml.asp?query=hallo. In my rails application i want to
fetch and handle this file as an xml object.

Can anyone help me?

Thanks.

Daan wrote:

In my rails application i want to fetch an external xml file

So my website www.test.com needs an xml file from
www.example.com/xml.asp?query=hallo. In my rails application i want to
fetch and handle this file as an xml object.

require ‘rio’
require ‘rexml/document’
url = “http://www.example.com/xml.asp?query=hallo
xml_doc = REXML::Document.new(rio(url))

More info here:
http://www.germane-software.com/software/rexml/docs/tutorial.html
and here:
http://rio.rubyforge.org/

I get the following error:

RIO::Rio is not a valid input stream. It must be
either a String, IO, StringIO or Source.

Alex Y. wrote:

Daan wrote:

In my rails application i want to fetch an external xml file

So my website www.test.com needs an xml file from
www.example.com/xml.asp?query=hallo. In my rails application i want to
fetch and handle this file as an xml object.

require ‘rio’
require ‘rexml/document’
url = “http://www.example.com/xml.asp?query=hallo
xml_doc = REXML::Document.new(rio(url))

More info here:
http://www.germane-software.com/software/rexml/docs/tutorial.html
and here:
http://rio.rubyforge.org/

Daan wrote:

I get the following error:

RIO::Rio is not a valid input stream. It must be
either a String, IO, StringIO or Source.

Oops… Should be:

xml_doc = REXML::Document.new(rio(url).read)

A lot of places, you can just use rio() and it’ll Just Work. Evidently
not here…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs