RSS Parser Help

I am trying to parse a rss file. I use the rss module to do it.

Suppose this is the data file,

Singapore Airlines Asia Travel - A345 All Business Class to Asia Fri, 18 Sep 2009 22:56:33 +0000 http://delicious.com/url/cc78bfa8bb00f50825d7cac52339375d#galvezcreative http://a345.singaporeair.com/ http://delicious.com/url/cc78bfa8bb00f50825d7cac52339375d http://feeds.delicious.com/v2/rss/url/cc78bfa8bb00f50825d7cac52339375d galvezcreative's bookmarks Industry-Airlines marketing

How do I parse to get value in category( In the above example it is
Industry-Airlines and marketing).

When i try rss.items[0].category , I get the entire element( In the
above case, Industry-Airlines)

Hi,

In [email protected]
“RSS Parser Help…” on Sat, 19 Sep 2009 09:21:36 +0900,
Gim I. [email protected] wrote:

  <link>http://a345.singaporeair.com/</link>
</item>

How do I parse to get value in category( In the above example it is
Industry-Airlines and marketing).

rss.items[0].categories.each do |category|
p category.content
end

When i try rss.items[0].category , I get the entire element( In the
above case, Industry-Airlines)

rss.items[0].category returns Category object not “<category
…>…” string. (Hint: Category object has #to_s
method that returns “<category …>…” string)

Thanks,

Thanks! I was using regular expressions to do this task!

On Sep 18, 8:21 pm, Gim I. [email protected] wrote:

  <link>http://a345.singaporeair.com/</link>
</item>

How do I parse to get value in category( In the above example it is
Industry-Airlines and marketing).

When i try rss.items[0].category , I get the entire element( In the
above case, Industry-Airlines)

Posted viahttp://www.ruby-forum.com/.

Alternate biterscripting script.

Script category.txt

var str rss ; cat “file.rss” > $rss
while ( { sen -r -c “^^” $rss } > 0 )
do
var str category ; stex -r -c “^<category&>&</category>^” $rss >
$category
stex -r -c “^<category&>^]” $category > null ; stex -r -c “[^</
category>^” $category > null
echo $category
done

For documentation on stex (string extractor) command, see
http://www.biterscripting.com/helppages/stex.html

Richard