<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.feed.consuming-atom">
<title>Consuming an Atom Feed</title>

    <para>
        <classname>Zend_Feed_Atom</classname> is used in much the same way as <classname>Zend_Feed_Rss</classname>. It provides
        the same access to feed-level properties and iteration over entries in the feed. The main
        difference is in the structure of the Atom protocol itself. Atom is a successor to RSS; it is more
        generalized protocol and it is designed to deal more easily with feeds that provide their full
        content inside the feed, splitting RSS' <code>description</code> tag into two elements,
        <code>summary</code> and <code>content</code>, for that purpose.
    </para>

    <example id="zend.feed.consuming-atom.example.usage">
        <title>Basic Use of an Atom Feed</title>
        <para>
            Read an Atom feed and print the <code>title</code> and <code>summary</code> of each entry:
        </para>
        <programlisting role="php"><![CDATA[
$feed = new Zend_Feed_Atom('http://atom.example.com/feed/');
echo 'The feed contains ' . $feed->count() . ' entries.' . "\n\n";
foreach ($feed as $entry) {
    echo 'Title: ' . $entry->title() . "\n";
    echo 'Summary: ' . $entry->summary() . "\n\n";
}
]]></programlisting>
    </example>

    <para>
        In an Atom feed you can expect to find the following feed properties:
    </para>

    <para>
        <itemizedlist>
            <listitem>
                <para><code>title</code> - The feed's title, same as RSS's channel title</para>
            </listitem>
            <listitem>
                <para><code>id</code> - Every feed and entry in Atom has a unique identifier</para>
            </listitem>
            <listitem>
                <para><code>link</code> - Feeds can have multiple links, which are distinguished by a
                <code>type</code> attribute</para>
                <para>
                    The equivalent to RSS's channel link would be <code>type="text/html"</code>. If the link
                    is to an alternate version of the same content that's in the feed, it would have a
                    <code>rel="alternate"</code> attribute.
                </para>
            </listitem>
            <listitem>
                <para><code>subtitle</code> - The feed's description, equivalent to RSS' channel description
                </para>
                <para><code>author->name()</code> - The feed author's name</para>
                <para><code>author->email()</code> - The feed author's email address</para>
            </listitem>
        </itemizedlist>
    </para>

    <para>
        Atom entries commonly have the following properties:
    </para>

    <para>
        <itemizedlist>
            <listitem>
                <para><code>id</code> - The entry's unique identifier</para>
            </listitem>
            <listitem>
                <para><code>title</code> - The entry's title, same as RSS item titles</para>
            </listitem>
            <listitem>
                <para><code>link</code> - A link to another format or an alternate view of this entry</para>
            </listitem>
            <listitem>
                <para><code>summary</code> - A summary of this entry's content</para>
            </listitem>
            <listitem>
                <para><code>content</code> - The full content of the entry; can be skipped if the feed just
                contains summaries</para>
            </listitem>
            <listitem>
                <para><code>author</code> - with <code>name</code> and <code>email</code> sub-tags like
                feeds have</para>
            </listitem>
            <listitem>
                <para><code>published</code> - the date the entry was published, in RFC 3339 format</para>
            </listitem>
            <listitem>
                <para><code>updated</code> - the date the entry was last updated, in RFC 3339 format</para>
            </listitem>
        </itemizedlist>
    </para>

    <para>
        For more information on Atom and plenty of resources, see
        <ulink url="http://www.atomenabled.org/">http://www.atomenabled.org/</ulink>.
    </para>
</sect1>
<!--
vim:se ts=4 sw=4 et:
-->