WSO2 Mashup Server, Atom/RSS Feed Host Object Guide

This document describes the set of host objects available for reading Atom and RSS feeds. These objects are capable of identifying feed types and handling them accordingly.

1.0 Introduction

The Feed implementation consists of three main host objects, namely Feed, Entry and FeedReader.

1.1 Feed and Entry

These host objects are capable of intelligently working with both Atom and RSS feeds. The underlying protocol implementation is kept transparent. However, some data might be lost due to this being an abstraction of both Atom and RSS feeds. The Feed host object is capable of persisting it's content to disk.

1.2 FeedReader

The FeedReader is a generic reader of Atom and RSS feeds.


2.0 Examples


//Creating an RSS 2.0 feed and writing it to file.

//Creating the Feed
var feed = new Feed();
feed.feedType = "rss_2.0";
feed.title = "This is a test Feed";
feed.description = "This feed demonsrates the use of Feed host object to create an RSS 2.0 feed.";
feed.link = "http://mooshup.com/rss20.xml";

//Creating Entries in the Feed
var entry = new Entry();
entry.title = "This is a test entry.";
entry.description = "This is a sample entry demonstrating the use of the Entry host object.";
feed.insertEntry(entry);

var entry2 = new Entry();
entry2.title = "This is another test entry.";
entry2.description = "This is a sample entry demonstrating the use of the Entry host object.";

//Adding a Media Module to the entry
var mediaModule = new MediaModule("http://www.earthshots.org/photos/387.jpg");
mediaModule.copyright = "2007 Tad Bowman";
mediaModule.type = "image/jpeg";
mediaModule.thumbnail = "http://www.earthshots.org/photos/387.thumb.jpg";
entry2.addMediaModule(mediaModule);

feed.insertEntry(entry2);

// Writing the newly created Feed to a File
var result = feed.writeTo("test-created-rss-feed.xml");


For a demonstration of this feature, please refer the TomatoTube sample in your WSO2 Mashup Server distribution.

3.0 References




© WSO2 Inc.