<?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 <acronym>RSS</acronym>; it is more generalized
        protocol and it is designed to deal more easily with feeds that provide their full content
        inside the feed, splitting <acronym>RSS</acronym>' <property>description</property> tag into
        two elements, <property>summary</property> and <property>content</property>, 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 <property>title</property> and
            <property>summary</property> of each entry:
        </para>

        <programlisting language="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>

    <itemizedlist>
        <listitem>
            <para>
                <property>title</property> - The feed's title, same as <acronym>RSS</acronym>'s
                 channel title
            </para>
        </listitem>

        <listitem>
            <para>
                <property>id</property> - Every feed and entry in Atom has a unique identifier
            </para>
        </listitem>

        <listitem>
            <para>
                <property>link</property> - Feeds can have multiple links, which are
                distinguished by a <property>type</property> attribute
            </para>

            <para>
                The equivalent to <acronym>RSS</acronym>'s channel link would be
                <command>type="text/html"</command>. if the link is to an alternate version of
                the same content that's in the feed, it would have a
                <command>rel="alternate"</command> attribute.
            </para>
        </listitem>

        <listitem>
            <para>
                <property>subtitle</property> - The feed's description, equivalent to
                <acronym>RSS</acronym>' channel description
            </para>

            <para><property>author->name()</property> - The feed author's name</para>
            <para><property>author->email()</property> - The feed author's email address</para>
        </listitem>
    </itemizedlist>

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

    <itemizedlist>
        <listitem>
            <para><property>id</property> - The entry's unique identifier</para>
        </listitem>

        <listitem>
            <para>
                <property>title</property> - The entry's title, same as <acronym>RSS</acronym>
                item titles
            </para>
        </listitem>

        <listitem>
            <para>
                <property>link</property> - A link to another format or an alternate view of
                this entry
            </para>
        </listitem>

        <listitem>
            <para><property>summary</property> - A summary of this entry's content</para>
        </listitem>

        <listitem>
            <para>
                <property>content</property> - The full content of the entry; can be skipped if
                the feed just contains summaries
            </para>
        </listitem>

        <listitem>
            <para>
                <property>author</property> - with <property>name</property> and
                <property>email</property> sub-tags like feeds have
            </para>
        </listitem>

        <listitem>
            <para>
                <property>published</property> - the date the entry was published, in
                <acronym>RFC</acronym> 3339 format
            </para>
        </listitem>

        <listitem>
            <para>
                <property>updated</property> - the date the entry was last updated, in
                <acronym>RFC</acronym> 3339 format
            </para>
        </listitem>
    </itemizedlist>

    <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:
-->