Topic: Generate simple RSS reader

here's my code to generate the rss reader. Ideally i want to parse the RSS news site, then scrap out the headlines, description, link(URL), and date.

***********************************************************************************
    def test

    rss = nil
    begin
    @rss = RSS::Parser.parse('http://thestar.com.my/rss/mostview/entertainment.xml')
    rescue RSS::InvalidRSSError
    @rss = RSS::Parser.parse('http://thestar.com.my/rss/mostview/entertainment.xml', false)
    end

    a = nil
    process "a", :new => :text, :title => :text, :link => "@href", :desc => :text,:date =>   :date
   
    rss = rss.new
    rss.new = ["rss-feed.xml"]
    rss.title = ["the Satr RSS-feed"]
    rss.link = ["http://www.rubyrss.com"]
    rss.desc = ["the Star RSS-feed generated by RubyRSS"]
    rss.date = Time.now.gmtime
    1.upto(10) { |i|
        rss.items << RSS::Item.new(
        "title-" + i.to_s,
        "#" + String(i),
        "description-#{i}",
        Time.now.gmtime
        )
    }
   
    rss.generate "rss2.0"
    end
************************************************************************************
i found errors:

undefined method `parameters' for "a":String

RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace

C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:122:in `set_session_options_without_components'
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:178:in `set_session_options'
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:116:in `process'
#{RAILS_ROOT}/app/controllers/new_controller.rb:31:in `parse'
*************************************************************************************
Can anyone plz tell me wat's wrong wit my code.
So sorry if i am asking stupid question, i am newbbie:D
thanks, and happy new year

Re: Generate simple RSS reader

this is my code to grab headlines, link and description for a news rss site eg. "http://thestar.com.my/rss/nation.xml" and it works.

def parse
        url = 'http://thestar.com.my/rss/nation.xml'
        feed = RSS::Parser.parse(open(url),false)
        puts "===Channel:#{feed.channel.title}==="
        feed.items.each do |item|
            puts item.title
            puts "(#{item.link})"
            puts item.description
            puts "----------------------------------------------------------------------"
           
       end
   end

The code works pretty well.The headlines, links and descriptions for every news are grabbed and appears in the command prompt.
Now my question is:
instead of showing the headlines, links and descriptions for every news in command prompt, i wanna to add it into a phpMyadmin database, arrange it neatly.

Any suggestion?
big_smile thanks