Reading RSS Feed in Groovy

The more I explore, the more I love groovy. Last week while I was demonstrating a few colleagues of mine, that how simple things are really dead-simple in groovy, I wrote this small code that fetches the rss feed and prints the headlines. Just thought of sharing with all.
// setup proxy, if any["http.proxyHost":"your.proxy", "http.proxyPort":"8080"])             

// define the url, change it to whatever rss url you like
def url = ""

def rss = new XmlSlurper().parse(url) 

println {
    println "- ${it.title}"
That's it! You have headlines in your output. How can you not love the brevity yet expressiveness of this code:)

1 comment:

Anonymous said...

But, what about this kind of link?