Feeds

Retrieving RSS/Atom Feeds with the Google AJAX Feed API

Using feeds to manage online news.

Providing a secure and efficient Helpdesk

You now iterate over the entries to obtain each of the entries in the Atom Feed. Specify the attributes to be displayed:

 var attributes = ["title", "link", "publishedDate", "contentSnippet"];

Then, create a <div> element for each of the attributes and add the <div> elements to the container <div> element:

 for (var j = 0; j < attributes.length; j++) {
        var div = document.createElement("div");
        div.appendChild(document.createTextNode(entry[attributes[j]]));
        container.appendChild(div);
      }

The JavaScript application, GoogleRSS-JSON.html, to display the JSON properties from the Atom Feed is available in the Resources zip file.

Run the GoogleRSS-JSON.html application. The Atom Feed entries’ titles, links, publication date, and content snippet are displayed – see Figure 5:

Shows the Atom feed with JSON Properties.

Next, we shall display multiple feeds using the FeedControl class. We’ll display the “Reg Developer” Atom feed and the “Editors Blog” Atom feed. As in the JavaScript application, to display a single feed specify a <script> tag for the Google Feed APIs. Add a <div> element to the JavaScript application to display the Atom Feeds:

 <body><div id="feedControl">Loading</div></body> 

Load version 1 of the Feed API. Invoke a callback function initialize after the Google Feed API has loaded. In the callback function create a FeedControl object:

 var feedControl = new google.feeds.FeedControl();

Specify the Atom Feeds to be loaded by the FeedControl:

 feedControl.addFeed("http://www.regdeveloper.co.uk/headlines.atom", "Reg Developer");
feedControl.addFeed("http://www.regdeveloper.co.uk/editors_blog/headlines.atom", 
"Editors Blog");

Load the Atom Feeds and display the Atom Feeds using the draw method:

 feedControl.draw(document.getElementById("feedControl"));

The JavaScript application, GoogleRSS-MultipleFeeds.html, to load multiple Atom Feeds is available in the Resources zip file. Now run the JavaScript application, and multiple Atom feeds are displayed – see Figure 6:

Shows multiple feeds.

You should now have successfully received an Atom feed. As it happens, the applications in this article may be used with either an Atom 1.0 feed or an RSS 2.0 feed (we’ve used Atom 1.0). However, the url for RSS 2.0 would be different: instead of http://www.regdeveloper.co.uk/headlines.atom, it would be http://www.regdeveloper.co.uk/headlines.rss. ®

Secure remote control for conventional and virtual desktops

More from The Register

next story
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
Not appy with your Chromebook? Well now it can run Android apps
Google offers beta of tricky OS-inside-OS tech
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
Greater dev access to iOS 8 will put us AT RISK from HACKERS
Knocking holes in Apple's walled garden could backfire, says securo-chap
NHS grows a NoSQL backbone and rips out its Oracle Spine
Open source? In the government? Ha ha! What, wait ...?
Google extends app refund window to two hours
You now have 120 minutes to finish that game instead of 15
Intel: Hey, enterprises, drop everything and DO HADOOP
Big Data analytics projected to run on more servers than any other app
prev story

Whitepapers

Secure remote control for conventional and virtual desktops
Balancing user privacy and privileged access, in accordance with compliance frameworks and legislation. Evaluating any potential remote control choice.
Saudi Petroleum chooses Tegile storage solution
A storage solution that addresses company growth and performance for business-critical applications of caseware archive and search along with other key operational systems.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.
Providing a secure and efficient Helpdesk
A single remote control platform for user support is be key to providing an efficient helpdesk. Retain full control over the way in which screen and keystroke data is transmitted.