On of my challenges for last week was to find an easy way to add an RSS feed to a Notes application. After doing some research on the topic I found that the XML required for an RSS feed is fairly simple and there were already a number of excellent examples out there within the Notes community. In the spirit of the .Domino Framework I wanted a generic solution which could easily applied to multiple applications. In the end I based some of my my code on the OpenNTF Blogsphere (thanks Declan).
I have created a new DominoRSS Feed class. This is intented to be part of a new Domino.Applications.RSS namespace but I have been having technical problems getting the same code to run as a Web agent when placed in a LotusScript library. So, for now, the class definition is included as part of the agent.
A new agent has been developed with an alias of content.rss that invokes various methods/properties in the class to generate the necessary XML. The code for the agent is as follows:-
Sub Initialize
Dim RSSEngine As DominoRSSFeed
Set RSSEngine = New DominoRSSFeed(Nothing)
RSSEngine.NotesLinks = True
Call RSSEngine.GenerateHeader
Call RSSEngine.GenerateViewContent("($RSS)",0)
Call RSSEngine.GenerateFooter
Call RSSEngine.WriteXML
End Sub
- The NotesLinks property is used to determine if the RSS Feed should publish links using http protocol (default) or Notes protocol. In my case I wanted the documents to launch in the Notes client as the source application is not Web-enabled.
- The GenerateHeader method creates the initial XML for the feed/channel
- The GeneratViewContent method creates the XML for the feed based upon the contents of the provided view. The view can be any view with the programatic column name for each column used to create XML elements. Use any of the available RSS feed attributes such as "title", "description","author","pubDate" to map the view content to the RSS feed.
- The GenerateFooter method creates the closing XML
- The WriteXML method takes the XML held internally within a NotesStream and writes it back to the screen.
I can now make any application RSS enabled by simply adding the agent (with the DominoRSSFeed Class) and having a view that meets the requirements above.
Note: The code for the class will be published as part of the next beta of the .Domino Framework later this month. .Domino Framework wiki will provide documentation on the RSS Feed XML. I will also be working on an enhancement to define various RSS attributes (e.g. Description) as part of the Application Settings.