How to remove tags <! [CDATA []]> with all the text in XML using Hpricot?
3 answers
doc = Hpricot::XML(open('http://www.cnn.com/.element/ssi/www/auto/2.0/video/xml/most_popular.xml')) (doc/:cnn_video/:video).each do |status| ['tease_txt'].each do |el| puts "#{status.at(el).inner_text}" end end Example output (looks like spam, but it's not spam!):
Reno's New Air Crash Show Shows Impact
Teen catches a 800 kg gator
Resume Career Do Not Ask Cancel Creepy Skirts Peepers
A satellite-sized bus to reach Earth ... "DWTS" throws ballroom for the first time
What caused the death of a coach at SeaWorld?
What led to the denial of Troy Davis's pardon?
+1