CBC World News RSS parser


/ Published in: Groovy
Save to your folder(s)

Reads CBC news RSS with fancy-prints its in table, splitting news description by image & text.


Copy this code and paste it in your HTML
  1. <table border=0 align=center>
  2. <%
  3. new XmlParser().parse('http://rss.cbc.ca/lineup/world.xml').channel.item.each {
  4. it.description.text().find('(<img [^>]+>).*<p>([^<]+)</p>') {mtc, img, txt ->
  5. out << """<tr><td rowspan=2>$img</td><th>${it.title.text()}</th></tr>
  6. <tr><td>$txt</td></tr>"""
  7. }
  8. }
  9. %>
  10. </table>

URL: cbc_world_news_gsp

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.