Feeds

Retrieving RSS/Atom Feeds with the Google AJAX Feed API

Using feeds to manage online news.

The Power of One Brief: Top reasons to choose HP BladeSystem

For JSON result format the <feed> element has the sub-elements described in the following table:

Sub-Element Description
title Specifies the feed title.
link Specifies the URL of the HTML version of the feed.
description Specifies the feed description.
author Specifies the feed author.
entries[] One or more entries may be present. Each entry has the following sub-elements: title-The entry title.link-URL of the HTML version of the entry.content- Specifies content of the entry including HTML tags. contentSnippet-A snippet version of the content. publishedDate-Date of publication.categories[]-One or more category String tags.

For google.feeds.Feed.MIXED_FORMAT result format, both the feed and xmlDocument sub-elements are present in the root element. An additional sub-element called xmlNode is present for each entry for MIXED_FORMAT. The xmlNode sub-element is a pointer to the XML element in the XML document in the xmlElement element.

The google.feeds.FeedControl class is used to download and display multiple feeds. The FeedControl methods are described in the following table:

Method Description
addFeed(url, label) Adds the feed specified by the url to the FeedControl.
draw(element, opt_options?) Loads the feeds and displays the feeds. The element argument specifies the DOM node that contains the resulting entries. The optional opt_options specifies the control options as a JSON object to display the results. The object has a single property called drawMode, which has the value google.feeds.FeedControl.DRAW_MODE_TABBED or google.feeds.FeedControl.DRAW_MODE_LINEAR (default).
setNumEntries(num) Specifies the number of entries for each feed. Default value is 4.
setLinkTarget(linkTarget) Specifies the link target to display the HTML for an entry. The following values may be specified:google.feeds.LINK_TARGET_BLANK google.feeds.LINK_TARGET_SELF (default)google.feeds.LINK_TARGET_TOP google.feeds.LINK_TARGET_PARENT

The Google Ajax Feed API provides a global method google.feeds.getElementsByTagNameNS(node, ns, localName), which returns a NodeList of elements of the specified local name and namespace URI.

Preliminary Setup

We want to develop a JavaScript application to download and display RSS/Atom feeds with the Google Ajax API. First, we need to register a web application URL with the Google AJAX Feed API to download and display Atom feeds.

We shall create the JavaScript application in JDeveloper. Download and install JDeveloper 10.1.3.2. To create a JDeveloper application select File>New and subsequently select General>Application in the New Gallery Click on OK. Specify an Application Name and click on OK. Specify a Project Name and click on OK. A new application and project are added to the Applications-Navigator.

Add a HTML page to the JDeveloper project by selecting the project node and selecting File>New and subsequently selecting Web Tier>HTML>HTML Page. An HTML page is added as shown in Figure 1.

Shows the JDeveloper Application.

We need to register the URL for the HTML page with the Google Ajax Feed API. Right-click on the HTML page and select Run. Obtain the URL, which is http://142.179.34.223:8990/GoogleRSS-GoogleRSS-context-root. Sign up for the Google AJAX Feed API using the URL http://code.google.com/apis/ajaxfeeds/signup.html as shown in Figure 2. Click on the Generate API Key button to generate the API key (you’ll need to be logged in to your Google user account to generate this).

Shows the generation of a Google Feed API key

Seven Steps to Software Security

More from The Register

next story
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
How modern custom applications can spur business growth
Learn how to create, deploy and manage custom applications without consuming or expanding the need for scarce, expensive IT resources.
Securing Web Applications Made Simple and Scalable
Learn how automated security testing can provide a simple and scalable way to protect your web applications.