Copyright © tutorialspoint.com

RSS Version 1.0 Tags and Syntax

previous


Advertisements

RSS Version 1.0 Tags:

Here is the structure of an RSS 1.0 document:

<?xml version="1.0"?>
<rdf:RDF>
   <channel>
      <title>...</title>
      <link>...</link>
      <description>...</description>
      <image />
      <items>...</items>
      <textInput />
   <image>
      <title>...</title>
      <url>...</url>
      <link>...</link>
   </image>
   <item>
      <title>...</title>
      <link>...</link>
      <description>...</description>
   </item>
   ......More item tags.....
   <textInput>
      <title>...</title>
      <description>...</description>
      <name>...</name>
      <link>...</link>
   </textInput>
</rdf:RDF>

Here is the detail of all optional and mandatory tags related to RSS 1.0. Check out given example to prepare a RSS v1.0 feed for your website.

NOTE: All the tag are case sensitive and should be used carefully.

XML version identifier:

As an XML application, an RSS document is not required to begin with an XML declaration. It should start with XML version identifier tag.

Syntax:

Here is list of RSS v1.0 Supported Encodings.

Required:

Always and exact. Optional encoding attribute (default is UTF-8).

rdf:RDF Tag

The outermost level in every RSS 1.0 compliant document is the RDF element. The opening RDF tag assocaties the rdf: namespace prefix with the RDF syntax schema and establishes the RSS 1.0 schema as the default namespace for the document.

Syntax:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/">

Required:

Always and exact.

Start Channel Tag:

The channel element contains metadata describing the channel itself, including a title, brief description, and URL link to the described resource (the channel provider's home page, for instance).

The {resource} URL of the channel element's rdf:about attribute must be unique with respect to any other rdf:about attributes in the RSS document and is a URI which identifies the channel. Most commonly, this is either the URL of the homepage being described or a URL where the RSS file can be found.

Syntax:

<channel rdf:about="{resource}">

Required:

Required. Maximum 1 per RSS file.

Channel Title:

An identifying string for a resource. When used in an item, this is the name of the item's link. When used in an image, this is the Alt text for the image. When used in a channel, this is the channel's title. When used in a textinput, this is the the textinput's title.

Syntax:

<title>TutorialsPoint</title>

Required:

Required.

Max Length

1-40 characters.

Channel Link (URL):

The URL to which an HTML rendering of the channel title will link, commonly the parent site's home or news page

Syntax:

<link>http://www.tutorialspoint.com</link>

Required:

Required.

Max Length

1-500 characters.

Channel Description:

A channel will have a description tag as described below:

Syntax:

<description>Your source for tutorials, references and manuals!</description>

Required:

Required.

Max Length

1-500 characters.

Channel Image Tag:

Establishes an RDF association between the optional image element and this particular RSS channel. The rdf:resource's {image_uri} must be the same as the image element's rdf:about {image_uri}.

Syntax:

<image rdf:resource="{image_uri}" />

Required:

Required only if image element present in document body

Channel Item Tag:

An RDF table of contents, associating the document's items with this particular RSS channel. Each item's rdf:resource {item_uri} must be the same as the associated item element's rdf:about {item_uri}.

An RDF Seq (sequence) is used to contain all the items rather than an RDF Bag to denote item order for rendering and reconstruction.

Note that items appearing in the document but not as members of the channel level items sequence are likely to be discarded by RDF parsers.

Syntax:

<items><rdf:Seq><rdf:li resource="{item_uri}" /> ... </rdf:Seq></items>

Required:

Required

Channel textInput Tag

Establishes an RDF association between the optional textinput element and this particular RSS channel. The {textinput_uri} rdf:resource must be the same as the textinput element's rdf:about {textinput_uri}.

Syntax:

<textinput rdf:resource="{textinput_uri}" />

Required:

Required only if texinput element present

End Channel Tag:

One end channel is required for a channel start tag.

Syntax:

</channel>

Required:

image Start Tag:

An image to be associated with an HTML rendering of the channel. This image should be of a format supported by the majority of Web browsers. While the later 0.91 specification allowed for a width of 1-144 and height of 1-400, convention (and the 0.9 specification) dictate 88x31.

Syntax:

<image rdf:about="{image_uri}">

Required:

Optional; if present, must also be present in channel element

image title Tag:

The alternative text ("alt" attribute) associated with the channel's image tag when rendered as HTML.

Syntax:

<title>{image_alt_text}</title>

Required:

Required if the image element is present

Max Length

1-40 characters.

image url Tag:

The URL of the image to used in the "src" attribute of the channel's image tag when rendered as HTML.

Syntax:

<url>{image_url}</url>

Required:

Required if the image element is present

Max Length

1-500 characters.

image link Tag:

The URL to which an HTML rendering of the channel image will link. This, as with the channel's title link, is commonly the parent site's home or news page.

Syntax:

<link>{image_link}</link>

Required:

Required if the image element is present

Max Length

1-500 characters.

image End Tag:

Closing tag for image tag.

Syntax:

</image>

Required:

Required; if image tag is present

Item Start Tag:

While commonly a news headline, with RSS 1.0's modular extensibility, this can be just about anything: discussion posting, job listing, software patch -- any object with a URI. There may be a minimum of one item per RSS document. While RSS 1.0 does not enforce an upper limit, for backward compatibility with RSS 0.9 and 0.91, a maximum of fifteen items is recommended.

item_uri} must be unique with respect to any other rdf:about attributes in the RSS document and is a URI which identifies the item. {item_uri} should be identical to the value of the <link> sub-element of the <item> element, if possible.

Recommended number of items per feed are 1-15.

Syntax:

<item rdf:about="{item_uri}">

Required:

Required 1 or more.

Item title tag:

The item's title.

Syntax:

<title>{item_title}</title>

Required:

Required; with each item tag

Max Length

1-100 characters.

Item link tag:

The item's URL.

Syntax:

<link>{item_link}</link>

Required:

Required; with each item tag

Max Length

1-500 characters.

Item description tag:

A brief description/abstract of the item.

Syntax:

<description>{item_description}</description>

Required:

Optional; with an item tag

Max Length

1-500 characters.

item End Tag:

Closing tag for item tag.

Syntax:

</item>

Required:

Required; for each item tag

Start Text Input Tag:

An input field for the purpose of allowing users to submit queries back to the publisher's site. This element should have a title, a link (to a cgi or other processor), a description containing some instructions, and a name, to be used as the name in the HTML tag <input type=text name="[name]">

Syntax:

<textinput rdf:about="{textinput_uri}">

Required:

Optional; if present, must also be present in channel element

Textinput title tag:

A descriptive title for the textinput field. For example: "Subscribe" or "Search!".

Syntax:

<title>{textinput_title}</title>

Required:

Required if textinput is present

Max Length

1-40 characters.

Textinput description tag:

A brief description of the textinput field's purpose. For example: "Subscribe to our newsletter for..." or "Search our site's archive of...".

Syntax:

<description>{textinput_description}</description>

Required:

Required if textinput is present

Max Length

1-100 characters.

Textinput name tag:

The text input field's (variable) name.

Syntax:

<name>{textinput_varname}</name>

Required:

Required if textinput is present

Max Length

1-500 characters.

Textinput link tag:

The URL to which a textinput submission will be directed (using GET).

Syntax:

<link>{textinput_action_url}</link>

Required:

Required if textinput is present

Max Length

1-500 characters.

Textinput End tag:

CLosing tag for textInput.

Syntax:

</textInput>

Required:

Required with textinput

rdf:RDF End Tag:

This is closing tag for an RSS1.0 document.

Syntax:

</rdf:RDF>

Required:

Required

Using Special Characters and HTML Entities:

Although an RSS 1.0 file is an XML document, RSS 0.91 extends XML by supporting a full set of HTML entities. If you want to use special characters such as ampersands (&) in <url> or <link> tags, you must substitute the appropriate decimal or HTML entities for those characters.

Check for a complete set of HTML entities.

RSS version 1.0 Example Feed:

Here is the example feed files which shows how to write RSS Feed using version 1.0.

<?xml version="1.0"?>

<rdf:RDF 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://purl.org/rss/1.0/">

  <channel rdf:about="http://www.tutorialspoint.com">
    <title>TutorialsPoint</title>
    <link>http://tutorialspoint.com/rss</link>
    <description>
      Online Tutorials and Reference Manuals
    </description>

    <image rdf:resource=
    "http://tutorialspoint.com/images/tp-logo.gif" />

    <items>
       <rdf:Seq>
       <rdf:li resource="http://tutorialspoint.com/rss/index.htm" />
       <rdf:li resource="http://tutorialspoint.com/php/index.htm" />
       </rdf:Seq>
    </items>

    <textinput rdf:resource=
    "http://www.tutorialspoint.com/cgi-bin/tp-contact.cgi" />

  </channel>
  
  <image rdf:about="http://tutorialspoint.com/images/tp-logo.gif">
    <title>TutorialsPoint Logo</title>
    <link>http://tutorialspoint.com</link>
    <url>http://tutorialspoint.com/images/tp-logo.gif</url>
  </image>

  
  <item rdf:about="http://tutorialspoint.com/rss/index.htm">
    <title>A simple RSS tutorial</title>
    <link>http://tutorialspoint.com/rss/index.htm</link>
    <description>
        Learn RSS in simple and easy steps.
    </description>
  </item>
  
  <item rdf:about="http://tutorialspoint.com/php/index.htm">
    <title>A complete guide for PHP Programmers</title>
    <link>http://tutorialspoint.com/php/index.htm</link>
    <description>
        A free online guide for PHP. Learn PHP in very easy steps.
    </description>
  </item>

  <textinput rdf:about=
    "http://www.tutorialspoint.com/cgi-bin/tp-contact.cgi">
    <title>Contact TutorialsPoint</title>
    <description>
       Contact TutorialsPoint for more detail
    </description>
    <name>s</name>
    <link>
        http://www.tutorialspoint.com/cgi-bin/tp-contact.cgi
    </link>
  </textinput>

</rdf:RDF>

RSS 1.0 File Extension:

A specific file-extension for an RSS 1.0 document is not required. Either .rdf or .xml is recommended, the former being preferred.

RSS 1.0 modules:

RSS 1.0 modules are maintained in separate documents, available online at RSS 1.0 modules.


previous

Copyright © tutorialspoint.com