Compartilhar via


Simple List Extensions

Simple List Extensions

Really Simple Syndication (RSS) represents more than an aggregation and notification for news and blog sites. It is also about interacting with items and lists of items. The Simple List Extensions are designed as extensions to existing feed formats to make exposing ordered lists of items easier and more accessible to users.

This topic contains the following sections:

  • Introduction 
  • Identifying a List 
  • Sorting and Grouping 
  • Related Topics

Introduction

A feed is a collection of items. The feed typically represents either a subset of items or the entire collection of items that exists on a server. A feed that advertises the most recent items on the server often requires the server to keep track of change logs for items that have been removed, so that the items can also be removed from the client. However, if the feed represents the entire collection of items on the server, it may be treated as a list and server-side change logs are unnecessary. In addition, client applications can be optimized to adhere to the characteristics of lists.

Feed lists share the following attributes:

  • The feed content represents the entire collection of items.
  • Feed items are often ordered, such as in a Top 10 list.
  • Feed items may expose additional properties to facilitate sorting and grouping.

Identifying a List

The following XML element allows the publisher of a feed to indicate that the feed is intended to be consumed as a list. This element should be contained within the feed at the same level as other channel-specific properties.

<cf:treatAs>list</cf:treatAs>

When the Feed Download Engine encounters this element, it marks the feed as a list (see Feed.IsList) and replaces existing feed items instead of merging the new items with the old.

If an RSS aggregator ignores the list extension—the standard behavior—results can become jumbled over time; items will appear out of order and older items will not be removed from the feed until they expire.

Sorting and Grouping

The feed publisher may choose to indicate to the client which properties are useful for sorting and grouping (or filtering) purposes. These elements make reference to XML elements that are child-elements of the items within the same feed.

The cf:listinfo element is used for this purpose. The syntax for this element is as follows:

<cf:listinfo> 
  <cf:sort 
     ns="namespace" 
     element="element" 
     data-type="date|text|number"   
     label="User-readable name for the sort field" 
     default="true|false" />
     
  <cf:group 
     ns="namespace" 
     element="element" 
     label="User-readable name for the grouping" /> 
</cf:listinfo>

The cf:listinfo element may contain zero or more instances of either of two child-elements: cf:sort and cf:group. A feed may contain cf:listinfo without containing a cf:treatAs element.

Each instance of the cf:sort or cf:group element makes reference to a child-element that appears within each of the items of the feed.

  • The value which is to be sorted or grouped must be the content of the element itself (i.e., the character data contained in the element). Values of attributes cannot be used for sorting or grouping.
  • The element to be sorted or grouped must have no child-elements.
  • Only one instance of the element should appear in each feed item. Clients are free to ignore repeated instances.