RSS 2.0 Feed Template

This template displays supplied data in RSS 2.0 format. All data passed to this template can be alphanumeric.


Content Type:

application/xml

Context Script:

import com.urbancode.anthill3.domain.reporting.*;

ReportOutput output = (ReportOutput) context.get("output");

// validate that the report can be turned into a RSS feed
if (!output.hasColumn("title") ||
    !output.hasColumn("date") ||
    !output.hasColumn("link") ||
    !output.hasColumn("guid") ||
    !output.hasColumn("description")) {
    throw new Exception("The report output does not support the RSS template");
}

context.put("pubDate", new Date());

Template Text:

<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>$report.Name</title>
    <link>$reportUrl.replaceAll("&","&")</link>
    <description>$report.Description</description>
    <language>en-us</language>
    <pubDate>$pubDate</pubDate>
    <generator>Anthill3</generator>
#foreach($row in $output.RowArray)
    <item>
      <title>$row.getColumnValue("title")</title>
      <link>$row.getColumnValue("link")</link>
      <description>$row.getColumnValue("description")</description>
      <pubDate>$row.getColumnValue("date")</pubDate>
      <guid>$row.getColumnValue("guid")</guid>
    </item>
#end
  </channel>
</rss>

Related Content

AnthillPro Template Reports
Report Templates