1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.feed.consuming-atom">
4 <title>Consuming an Atom Feed</title>
7 <classname>Zend_Feed_Atom</classname> is used in much the same way as
8 <classname>Zend_Feed_Rss</classname>. It provides the same access to feed-level properties
9 and iteration over entries in the feed. The main difference is in the structure of the Atom
10 protocol itself. Atom is a successor to <acronym>RSS</acronym>; it is more generalized
11 protocol and it is designed to deal more easily with feeds that provide their full content
12 inside the feed, splitting <acronym>RSS</acronym>' <property>description</property> tag into
13 two elements, <property>summary</property> and <property>content</property>, for that
17 <example id="zend.feed.consuming-atom.example.usage">
18 <title>Basic Use of an Atom Feed</title>
21 Read an Atom feed and print the <property>title</property> and
22 <property>summary</property> of each entry:
25 <programlisting language="php"><![CDATA[
26 $feed = new Zend_Feed_Atom('http://atom.example.com/feed/');
27 echo 'The feed contains ' . $feed->count() . ' entries.' . "\n\n";
28 foreach ($feed as $entry) {
29 echo 'Title: ' . $entry->title() . "\n";
30 echo 'Summary: ' . $entry->summary() . "\n\n";
36 In an Atom feed you can expect to find the following feed properties:
42 <property>title</property> - The feed's title, same as <acronym>RSS</acronym>'s
49 <property>id</property> - Every feed and entry in Atom has a unique identifier
55 <property>link</property> - Feeds can have multiple links, which are
56 distinguished by a <property>type</property> attribute
60 The equivalent to <acronym>RSS</acronym>'s channel link would be
61 <command>type="text/html"</command>. if the link is to an alternate version of
62 the same content that's in the feed, it would have a
63 <command>rel="alternate"</command> attribute.
69 <property>subtitle</property> - The feed's description, equivalent to
70 <acronym>RSS</acronym>' channel description
73 <para><property>author->name()</property> - The feed author's name</para>
74 <para><property>author->email()</property> - The feed author's email address</para>
79 Atom entries commonly have the following properties:
84 <para><property>id</property> - The entry's unique identifier</para>
89 <property>title</property> - The entry's title, same as <acronym>RSS</acronym>
96 <property>link</property> - A link to another format or an alternate view of
102 <para><property>summary</property> - A summary of this entry's content</para>
107 <property>content</property> - The full content of the entry; can be skipped if
108 the feed just contains summaries
114 <property>author</property> - with <property>name</property> and
115 <property>email</property> sub-tags like feeds have
121 <property>published</property> - the date the entry was published, in
122 <acronym>RFC</acronym> 3339 format
128 <property>updated</property> - the date the entry was last updated, in
129 <acronym>RFC</acronym> 3339 format
135 For more information on Atom and plenty of resources, see
136 <ulink url="http://www.atomenabled.org/">http://www.atomenabled.org/</ulink>.