Web design portfolio - The item Element The item element may occur
The item Element The item element may occur any number of times in an RSS 2.0 information feed document. Its child elements are described in the following list. The specification is unclear about whether or not these child elements are required. In practice, you can use which child elements you want and omit those you don t. There are theoretically some situations in which you could be in conflict with the wording of the RSS 2.0 specification but this won t arise with real-world items with a title and at least some content. . author: This contains an e-mail address for a person with responsibility for authoring the content of the item. . category: An item element can have multiple category element children. The content of the category element is information about a category into which the content of the item may be assigned. Each category element has an optional domain attribute, the value of which may specify a taxonomy to which the content of the item belongs. For example, in an item about XML the domain might be markup languages. . comments: This contains a URL of a Web page where a user can enter comments about the item. . description: This contains a summary of the item or, in the case of items with a relatively small amount of text, might contain the full text of the item. . enclosure: This contains information specifying a media object associated with the item. This is an empty element with three attributes. The url attribute contains a URL from which the media object can be retrieved. The length attribute specifies the size of the serialized object in bytes. The type attribute specifies the media type of the object. . guid: This contains a value that uniquely identifies the item. The RSS 2.0 specification does not specify rules intended to achieve uniqueness. One typical approach is to use a URL from which the item can be retrieved. In that situation the guid element is likely to have an isPermaLink attribute with a value of true. . link: This contains a URL that can be used to retrieve the full text of the item. When the item contains its full text in the description element, the link element is optional; otherwise, it is required. . pubDate: This contains information about when the item was published. It includes both date and time components. . source: This contains information about the channel (perhaps on another site) that the item originally came from. It has a url attribute that contains the URL for the source information feed. The content of the source element is, typically, the title of the feed. . title: This contains a title for the item. An example item element is shown in the following example RSS 2.0 document. An Example RSS 2.0 Document Having looked at the individual parts of the document structure of an RSS 2.0 document, you can now take a look at a sample RSS 2.0 document that happens to contain my first author blog post on Wrox.com. 126 Chapter 12