Common Constructs


Advertisements

Category

<category> has one required attribute, term, and two optional attributes, scheme and label.

term identifies the category.

scheme identifies the categorization scheme via a URI.

label provides a human-readable label for display.

Content

<content> either contains, or links to, the complete content of the entry.

In the most common case, the type attribute is either text, html, xhtml, in which case the content element is defined identically to other text constructs, which are described here.

Otherwise, if the src attribute is present, it represents the URI of where the content can be found. The type attribute, if present, is the media type of the content.

Otherwise, if the type attribute ends in +xml or /xml, then an xml document of this type is contained inline.

Otherwise, if the type attribute starts with text, then an escaped document of this type is contained inline.

Otherwise, a base64 encoded document of the indicated media type is contained inline.

Link

<link> is patterned after html's link element. It has one required attribute, href, and five optional attributes: rel, type, hreflang, title, and length.

href is the URI of the referenced resource (typically a Web page).

rel contains a single link relationship type. It can be a full URI or one of the following predefined values (default=alternate):

  • alternate: An alternate representation of the entry or Feed, for example a permalink to the html version of the entry, or the front page of the weblog.
  • enclosure: A related resource, which is potentially large in size and might require special handling, for example an audio or video recording.
  • related: An document related to the entry or Feed.
  • self: The Feed itself.
  • via: The source of the information provided in the entry.

type indicates the media type of the resource.

hreflang indicates the language of the referenced resource.

title indicates the human readable information about the link, typically for display purposes.

length indicates the length of the resource, in bytes.

Person

<author> and <contributor> describes a person, corporation, or similar entity. It has one required element, name, and two optional elements: uri, email.

<name> conveys a human-readable name for the person.

<uri> contains a home page for the person.

<email> contains an email address for the person.

Text

<title>, <summary>, <content>, and <rights> contain human-readable text, usually in small quantities. The type attribute determines how this information is encoded (default="text").

If type="text", then this element contains plain text with no entity escaped html.

<title type="text">AT&amp;T bought by SBC!</title>

If type="html", then this element contains entity escaped html.

<title type="html">
   AT&amp;amp;T bought &lt;b&gt;by SBC&lt;/b&gt;!
</title>

If type="xhtml", then this element contains inline xhtml, wrapped in a div element.

<title type="xhtml">
   <div xmlns="http://www.w3.org/1999/xhtml">
      AT&amp;T bought <b>by SBC</b>!
   </div>
</title>

Check complete specification for atom 1.0 RFC4287.

Atom 1.0 Example Feed

The example shows how to write a Feed using Atom 1.0.

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

   <title>Example Feed</title>
   <subtitle>Insert witty or insightful remark here</subtitle>
   <link href="http://example.org/"/>
   <updated>2003-12-13T18:30:02Z</updated>
   
   <author>
      <name>Mohtashim</name>
      <email>mohtashim@example.com</email>
   </author>
   
   <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
   
   <entry>
      <title>Tutorial on Atom</title>
      <link href="http://example.org/2003/12/13/atom03"/>
      <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
      <updated>2003-12-13T18:30:02Z</updated>
      <summary>Some text.</summary>
   </entry>
   
</feed>

Atom1.0 File Extension

A specific file-extension for an Atom 1.0 document is not required. But .xml is recommended.

what-is-atom.htm
Advertisements