Home arrow Web Services arrow Page 4 - Introduction to RSS
WEB SERVICES

Introduction to RSS


RSS is one of the simpler forms of what we know as Web Services. This latest article introduces us to RSS, and the many uses it offers for todays applications.

Author Info:
By: Unknown User
Rating: 5 stars5 stars5 stars5 stars5 stars / 4
October 07, 2003
TABLE OF CONTENTS:
  1. · Introduction to RSS
  2. · RSS Syntax
  3. · Creating RSS Files
  4. · The Four Main Sections of an RSS File
  5. · Working with RSS Files

print this article
SEARCH DEVARTICLES

Introduction to RSS - The Four Main Sections of an RSS File
(Page 4 of 5 )

After the root element come the four main sections of the RSS file. These are the channel, image, item, and text input sections. In practical use, the channel and item elements are requirements for any useful RSS file, while the image and text input are optional.

The Channel Section

The channel element contains metadata that describe the channel itself, telling what the channel is and who created it. The channel is a required element that includes the name of the channel, its description, its language, and a URL. The URL is normally used to point to the channel's source of information.  Listing 3 shows the beginning of the channel element. This part of the channel element defines the channel and begins the channel information.

<channel>

<title>MozillaZine</title>

<link>http://www.mozillazine.org</link>

<description>Your source for Mozilla news, advocacy, interviews, builds, and more! </description>

<language>en-us</language>

</channel>

The channel element contains the remaining channel tags, which describe the channel and allows it to be displayed in HTML. The title can be treated as a headline link with the description following. The Channel Language definition allows aggregators to filter news feeds and gives the rendering software the information necessary to display the language properly.

The </channnel> tag is used after all the channel elements to close the channel. As RSS conforms to XML specs, the element must be well formed; it requires the closing tag.

You can include nine optional tags in a 0.91 channel definition. Some examples are PICS Rating, Copyright Identifier, Publication Date, and Webmaster. You can use these additional elements for a variety of purposes. For example, sites that aggregate content can use this additional meta-information to allow users to filter news feeds on the basis of Platform for Internet Content Selection (PICS) ratings. For additional information on other Channel tags, look in the RSS specifications.

The Image Section

The image element is an optional element that is usually used to include the logo of the channel provider. The default size for the image is 88 pixels wide by 31 pixels high, but you can make your logo as large as 144 pixels wide by 400 pixels wide. Here is a sample image element:

<image>
   
<title>MozillaZine</title>

<url>http://www.mozillazine.org/image/mynetscape88.gif </url>

<link>http://www.mozillazine.org</link>

<width>88</width>

<height>31</height>

</image>

The image's title, URL, link, width, and height tags allow renderers to translate the file into HTML. The title tag is normally used for the image's ALT text. Keep the image to 88 x 31 or smaller if possible, because many renderers translate channels into fixed width tables as narrow as 100 pixels. Larger graphics could cause the tables to break inappropriately, or cause your image to be left out when displayed.

The Items

Items, the most important elements in a channel, usually form the dynamic part of an RSS file. While channel, image, and text input elements create the channel's identity and typically stay the same over long periods of time, channel items are rendered as news headlines, and the channel's value depends on their changing fairly frequently. Here is an example of a channel item:

<item>
    
<title>Java2 in Navigator 5?</title>

<link>http://www.mozillazine.org/talkback.html?article=607</link>

<description>Will Java2 be an integrated part of Navigator 5?
      Read more about it in this discussion...</description>

</item>

Fifteen items are allowed in a channel. This is a reasonable limitation, because most people use channels to distribute recent Web content. Titles should be less than 100 characters, while descriptions should be under 500 characters. The item title is normally rendered as a headline that links to the full article whose URL is provided by the item link. The item description is commonly used for either a summary of the article's content or for commentary on the article. News feed channels use the description to highlight the content of news articles, usually on the channel owner's site, and Web log channels use the description to provide commentary on a variety of content, often on third-party sites.

Much of the beauty of the RSS format lies in the item element. As you can see from the above example, items are easy for developers to define and easy for users to read.

The Text Input

The text input area is an optional element, with only one allowed per channel. Usually rendered as an HTML form, text input lets the user respond to the channel. You might use this feature to enable your users to subscribe to your newsletter or search your site. Here is an example of a text input element:

<textinput>
    
<title>Send</title>

<description>Comments about MozillaZine?</description>

<name>responseText</name>

<link>http://www.mozillazine.org/cgi-bin/sampleonly.cgi</link>

</textinput>

The title is normally rendered as the label of the form's submit button, and the description as the text displayed before or above the input field. The text input name is supplied along with the contents of the text field when the submit button is clicked.

These are the four main elements of an RSS file. After adding the image, item, and text input elements, remember to close the channel with the </channel> tag and the RSS file with the </rss> tag.

The proposed RSS 1.0 specification introduces modules, which will allow RSS to be extended to accommodate additional information without rewriting the specification. For example, you could write a module to add rich media to your channel for broadband clients while standard clients would still see headlines and descriptions. You may want to learn more about modules so that you can take advantage of them once the 1.0 specification is implemented.


blog comments powered by Disqus
WEB SERVICES ARTICLES

- Dealing with Loose Coupling in a Service-Ori...
- Loose Coupling in a Service-Oriented Archite...
- Safety, Idempotence, and the Resource-Orient...
- The Resource-Oriented Architecture in Action
- Features of the Resource-Oriented Architectu...
- The Resource-Oriented Architecture
- Getting Started with Flex
- Automated Billing and Faxing for the Web
- An Introduction to Web Services
- The Foundations of Web Services: From Novice...
- Web Services Reengineering: Finishing Touches
- Fault Handling with Web Services
- Flow and Web Services
- Process Lifecycles and Web Services
- Business Processes and Web Services

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials