I am in love with Groovy’s Builders… they make working with heirarchical structures a breeze. For instance, I needed to create an RSS feed for GroovyQuiz.com, and the builders make that so easy:
-
// … in a Controller somewhere far far away …
-
def rss = {
-
// render some XML markup to the response
-
def url = “http://groovyquiz.com/groovyquiz/main/quiz”
-
render(contentType:“text/xml”) {
-
rss(version: “2.0″) {
-
channel {
-
title “GroovyQuiz.com - Latest Quizzes”
-
link “http://groovyquiz.com”
-
description “Weekly Groovy language challenges to help you learn”
-
-
item {
-
title quiz.title
-
link “${url}/${quiz.number}”
-
description quiz.description
-
pubDate quiz.publishedDate()
-
guid “${url}/${quiz.number}”
-
}
-
-
}
-
}
-
}
-
}
aikune | 01-Apr-07 at 7:23 pm | Permalink
Does anyone how to subscribe content with downloaded *.rss or *.xml file? I have discovered that with some site when you click the rss botton provided it leads a download of the feed file rather than the url of the feed. How can be get around with it? Thank you for the hele.