Home arrow XML arrow Page 3 - Building an RSS File

Enhanced RSS Document Structure - XML

In the previous article we discussed how to read an RSS file with PHP. In this article we will focus on the theoretical aspects of how to build an RSS file.

TABLE OF CONTENTS:
  1. Building an RSS File
  2. Required Elements
  3. Enhanced RSS Document Structure
  4. Aggregators
By: Jacques Noah
Rating: starstarstarstarstar / 8
February 13, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Here's an example:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>The Programmers Site</title>
    <link>http://www.thelinker.com</link>
    <description>think big</description>
    <pubDate>Wed, 05 Apr 2006
23:58:37</pubDate>
   
<lastBuildDate>Wed, 05 Apr 2006
23:58:38</lastBuildDate>
   
<language>en-us</language>
   
<copyright>Copyright 2006, TheSite</copyright>
   
<webMaster>ad@k.com (John Doe)</webMaster>
   
<managingEditor>ad@l.com (John Doe)</managingEditor>
   
<generator>RSS Builder V1.0 2006(c)</generator>
   
<docs>http://blogs.law.harvard.edu/tech/rss</docs>

    <image>
     
<title>Site Image</title>
     
<link>http://www.thelinker.com</link>
     
<url>http://k.com/thelink.gif</url>
     
<width>20</width>
     
<height>20</height>
   
</image>

    <item>
      <title>The title of the story here</title>
      <link>the link to the story here</link>
      <description>The description here
      </description>
    </item>
  </channel>
</rss>

The section in bold is the only difference between a simple version and a enhanced version. The enhanced version makes more information about the creator of the RSS document available to the RSS reader and aggregators. None of this really matters as far as an RSS reader is concerned, as long as the required elements are included.

Take a careful look at the image tag. It has three required tags: title, link and url, and two optional tags: width and height. Table 3 below explains how these tags are used and what they are for.

Table 3:

Element

Description

Example

title

describes the image; it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.

RSS Tutorial

link

is the URL of the site; when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.

http://www.mysite.com/

url

is the URL of a GIF, JPEG or PNG image that represents the channel.

http://www.mysite.com/theimage.gif

width

Width of the image. Maximum value for width is 144, default value is 88.

44

Height

Height of the image. Maximum value for height is 400, default value is 31.

45



 
 
>>> More XML Articles          >>> More By Jacques Noah
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

XML ARTICLES

- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: