New Open-Source RSS Component
<cfset rss = createObject("component","rss").init("http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml") />
<cfoutput>
<cfif not structIsEmpty(rss.getImage())>
<img src="#rss.getImage().url#" alt="#rss.getImage().title#" />
</cfif>
<h3 style="margin:0px;">#rss.getTitle()#</h3>
<cfloop condition="#rss.hasNextItem()#">
<cfset rssItem = rss.next() />
<div style="margin-top:10px;margin-bottom:10px;">
<strong>
<a href="#rssItem.getLink()#">#rssItem.getTitle()#</a>
</strong>
<span style="font-size:11px;">(published on #dateFormat(rssItem.getPubDate(),"long")#)</span>
<br />
<cfif len(rssItem.getAuthor())>by #rssItem.getAuthor()#<br />
</cfif> #rssItem.getDescription()# </div>
</cfloop>
</cfoutput> Pretty simple right? You can view that example output here. You can also search for items by GUID or Title, which is a neat feature IMHO.
Ok, so now on to the limitations. It can be used to write RSS, but the underlying Java library is very limited when it comes to the setters on the rss.item class. Therefore, I have only figured out a way to set certain RSS item parameters, which negates its value substantially for writing RSS. If anyone out there knows a better Java library for doing this, I would love to hear about it (and would be happy to update the underlying code). A friend forwarded me RSSLibJ, but this (funny enough) says it is intended for writing RSS and not so much for reading (i.e. the opposite of the one I used).
You can click the download link on this post to download the code. The download includes the javaLoader.cfc and mjxml.jar as per their respective licenses. This is an early alpha of this code btw, so please notify me if there are bugs by commenting on this post.
MD

