Creating an RSS feed using Scala and Play
In previous Java projects I have used the ROME utility to create an RSS feed and it has worked fine. So my first thought when I needed to create a feed in Scala and Play was if I should use ROME again or if there was a native Scala alternative. I googled a bit but didn’t find anything obvious.
But since I only needed a very basic feed and I knew that Scala has excellent build in XML syntax I decided to roll it myself. And it couldn’t be simpler, both thanks to Scala and the simplicity of the Play framework.
Below is a code example for a Play Action that serves a feed. “NewsArticle.all” fetches the articles and then we loop them and output the title, text and link to the article. And that’s all there is to it, without any external dependencies.