Atom feeds specification
The format for Atom feeds is specified in RFC 4287.
Structure
An Atom feed is an XML document with a single feed element as the root.
The items in the feed are represented with /feed/entry elements.
These come after the metadata children.
The order of the entry elements doesn’t matter.
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>...</id>
<title type="text">...</title>
<link rel="self" type="application/atom+xml"
href="http://example.com/feed.atom"/>
<link rel="alternate" type="text/html" hreflang="en"
href="http://example.com/"/>
<!--snip-->
<entry>...</entry>
<entry>...</entry>
</feed>
Feed
Typical metadata provided as children of feed:
/feed/author[1..*] – see Author below- May only be omitted if all
entryelements have anentry/author.
- May only be omitted if all
/feed/id[1] – permanent, universally unique URI- May not be a relative reference.
/feed/linkwith attributerel="self"[0..1]- the preferred URI for retrieving this feed; recommended.
/feed/title[1]- If the title is not plain text, set the
typeattr tohtml, and escape the HTML markup.
- If the title is not plain text, set the
/feed/updated[1]- A date-time construct, incl. final “Z” or time zone offset, e.g. “2003-12-13T18:30:02Z”, “2003-12-13T18:30:02+01:00”.
Optional:
/feed/category[0..*] – see Category below/feed/contributor[0..*]- same format as
author
- same format as
/feed/generator[0..1] – program used to generate the feed- May have
uriandversionattrs.
- May have
/feed/icon[0..1] – URI- Should have an aspect ratio of 1:1.
/feed/logo[0..1] – URI- Should have an aspect ratio of 2:1 (wide).
/feed/linkwith attributerel="alternate"- at most 1 per (type × hreflang) combination
/feed/rights[0..1]/feed/subtitle[0..1]
Entry
Typical metadata provided as children of entry:
/feed/entry/title[1]/feed/entry/id[1] – permanent, universally unique URI- May not be a relative reference.
- Multiple entries with the same
idare considered the same entry, but it is up to the application what it does with the different versions. - Keep the same ID when publishing a new revision (even in a different feed).
/feed/entry/link[0..1] with attributerel="alternate"- Required if
contentis not provided.
- Required if
/feed/entry/updated[1] – timestamp of most recent update- Same format as
/feed/updated
- Same format as
/feed/entry/summary[0..1]- May have
type="xhtml", in which case, see/feed/entry/contentbelow. - May be absent if a
contentelement of type “xhtml” is provided.
- May have
Optional:
/feed/entry/link[0..*] with attributesrel="alternate"andhreflangfor translations- at most 1 per (type × hreflang) combination
/feed/entry/link[0..*] with attributesrel="enclosure" type="audio/mpeg"- Preferably also set the
lengthattr.
- Preferably also set the
/feed/entry/published[0..1] – timestamp of initial publication- Same format as
/feed/updated
- Same format as
/feed/entry/rights[0..1]/feed/entry/source[0..1] – if the entry was copied from a different feed- Use the metadata for the original feed and/or entry as children.
/feed/entry/author[0..*] – see Author below- May only be omitted if
/feed/authoris provided.
- May only be omitted if
/feed/entry/contributor[0..*]- same format as
author
- same format as
/feed/entry/category[0..*] – see Category below/feed/entry/content[0..1] with attrtype="xhtml"- Its child must be a single
<div xmlns="http://www.w3.org/1999/xhtml">. - Set the
xml:base="https://..."attr oncontentfor resolving relative links. - Set the
xml:lang="en"attr oncontent. - The
xml:baseandxml:langattributes could also be set on thefeedelement to reduce duplication. - Plain text or other media types are allowed instead of
type="xhtml". - Alternatively, leave the
contentempty and set itssrcattr and set thetypeattr to the appropriate mimetype.
- Its child must be a single
<entry>
<title>...</title>
<link rel="alternate" type="text/html"
href="http://example.org/..."/>
<id>...</id>
<updated>2005-07-31T12:29:29Z</updated>
<content type="xhtml"
xml:base="http://example.com/"
xml:lang="en">
<div xmlns="http://www.w3.org/1999/xhtml">
<p>...</p>
</div>
</content>
</entry>
Author
The author element can be used in feed or entry.
It has the following children:
author/name[1]author/uri[0..1]author/email[0..1]
Category
The category element can be used in feed or entry.
It has the following children:
category/term[1]category/scheme[0..1]category/label[0..1]