|
RSS ("Really Simple Syndication") is a web content syndication format. RSS is becoming the standard format for syndicating news content over the web. As part of my recent contract with Sun Microsystems, I was tasked with the development of a JSP Tag Library to be used by anybody with a basic understanding of RSS, JavaServer Pages, and HTML. The taglib is mostly geared towards non-technical editors of web sites that use RSS for aggregating news content. My goal was to develop a JSP tag library that would simplify the use of RSS content (versions 0.91, 0.92 and 2.0) in web pages.
The RSS Utilities Package is the result of that project. It contains a
set of custom JSP tags which make up the RSS Utilities Tag library, and
a flexible RSS Parser. This document describes how to use the parser
and the library provided in the RSS Utilities Package. Click
here to download the first release. The zip file contains a jar
file, Installing the taglib
Although it's easy to use the tag library, installing it requires some
knowledge of how your web server works and how to configure it. The
first step is to download and unzip the package. Once the zip file has
been unzipped, place a copy of <taglib> Using the taglib
Once the <%@ taglib uri="/WEB-INF/rssutils.tld" prefix="rss" %> Next, add an RSS feed to your JSP page using the feed tag, as in the following example:
The url attribute of the "
Once you have added one or more RSS feeds to your page, you should be able to extract almost any information out of the feeds using the remaining set of tags. Here is an example showing how to extract the title of the channel of the RSS feed we added above:
Taglib examplesExample 1 (RSS 0.91):
Example 2 (RSS 0.92):
Example 3 (RSS 2.0):
How to use the RssParserThe parser was, in a way, a by-product of the project. Although the parser was developed with the tag library in mind, it is completely self-contained, and it can be used in Java applications. To do so, however, you obviously need to know how to write at least basic Java code. (If you know how to write Hello World in the Java language, you are probably all set.)
First download and unzip the package. Once you have added RssParser parser = RssParserFactory.createDefault();
The RSS object generated by the parser is a Java object representation
of the RSS document found at the provided URL. Use the methods provided
by the RSS object to get a handle to other RSS objects, such as
Channels and Items. The ConclusionRSS provides a simple way to add and maintain news -- as well as other content -- on your web site, from all over the web. Even though RSS is a simple XML format, parsing and extracting data out of XML documents hosted elsewhere on the web can be a bit tricky-- or at least tedious -- if you have to do it over and over again. The RSS Utilities Package leverages Custom Tag and XML Parsing technologies to make the "Real Simple Syndication" format live up to its name. See also
Share your feedback and join our online discussion! Have a question about programming? Use Java Online Support. | |||||||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||