From: Hunter Walker Date: 2006-07-19T07:56:52+09:00 Subject: Re: process xml in a page Thank you, James. I got a step further, but still need help. This code outputs exactly what I want to see to the debug window: require 'open-uri' require "rexml/document" include REXML url = "http://clinicaltrials.gov/show/NCT00001372?displayxml=true" open(url) { |page| print page.read() } However, I am having trouble when using the REXML tutorial. Should I somehow save the output to an .xml file locally? Or should I add the output to a string? I am not sure how to do either as I am having trouble directing the "print" output anywhere. Thank you and sorry for the noobness. The api I used in a ruby project before made everything a bit too easy, so I am still learning. -Hunter James Britt wrote: > Hunter Walker wrote: >> Thank you for your help, as always. > Use open-uri to fetch the XML, then load it into a REXML::Document > object. > > Then use REXML's XPath to grab what you need. > > http://www.ruby-doc.org/stdlib/libdoc/open-uri/rdoc/ > http://www.ruby-doc.org/stdlib/libdoc/rexml/rdoc/index.html > > > > -- > James Britt > > http://www.ruby-doc.org - Ruby Help & Documentation > http://www.artima.com/rubycs/ - The Journal By & For Rubyists > http://www.rubystuff.com - The Ruby Store for Ruby Stuff > http://www.jamesbritt.com - Playing with Better Toys > http://www.30secondrule.com - Building Better Tools -- Posted via http://www.ruby-forum.com/.