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. -- Posted via http://www.ruby-forum.com/.
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/ -- Alex
I get the following error: RIO::Rio is not a valid input stream. It must be either a String, IO, StringIO or Source. Alex Young 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/-- Posted via http://www.ruby-forum.com/.
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... -- Alex