Anatomy of a pheed
This quick tutorial will pull apart a pheed document section by section. The complete document can be viewed here: example.rss. RSS is a very simple format easily parsed by machines and people alike which makes it handy for exchanging information.
<?xml version="1.0" encoding="iso-8859-1"?> <rss version="2.0" xmlns:photo="http://www.pheed.com/pheed/" xmlns:dc="http://purl.org/dc/elements/1.1/" >
The first element simply tells the person or program reading this that they should expect an xml document. This should be the first line of all your pheeds. Since this is an xml document there are a couple of things you need know. First, xml is case sensitive. <rss> and <RSS> are two different elements. Second, there are a few characters that are not allowed: &, <, >. These all mean something special to xml readers. If you need to use them in a document you will need to use these escape code: & < >
The next line tells us that this is more than an xml document--it is also an rss documment. You can think of it like the <html> tag used for webpages. Like html, xml uses opening and closing tags to enclose information. At the end of the document you will find this elements corresponding </rss> tag. The lines begining xmlns define two namespaces. This is what allows us to extend RSS to our purposes. With thes two lines we can now use elements that begin with photo: and dc:. dc stands for dublin core; for more information check out dublincore.org Like the first line, you don't need to worry too much about the rss element. Just make sure it looks like the example.
<channel> <title>Natural Landscape Photographs</title> <link>http://www.photo-mark.com/cgi-bin/set.cgi?set_id=7</link> <description>A few natural landscape photographs.</description> <language>en-us</language>
If the <rss> tag is analagous to html's <html> tag, the <channel> is like html's <body> tag. The <title>, <link>, and <description> elements are required and describe this collection as a whole. Individual images will also have these elements inside the <item> element. For details on these elements see the RSS 2.0 spec.
<item>
<title>Windmill Farm with Cloud</title>
<link>http://www.photomark.com/cgi-bin/set.cgi?set_id=7&n=0</link>
<description>
Windmill Farm at dusk with lenticular cloud, Wyoming
</description>
<category>In progress</category>
<dc:creator>Mark Meyer</dc:creator>
<dc:rights>Copyright 2001 Mark Meyer</dc:rights>
<dc:coverage>Wyoming</dc:coverage>
<dc:format>35mm Transparency</dc:format>
<photo:imgsrc>
http://www.photo-mark.com/webpix/ds/Windmillsa.jpg
</photo:imgsrc>
<photo:thumbnail>
http://www.photo-mark.com/webpix/tn/Windmillsa.jpg
</photo:thumbnail>
<photo:subject>
windmill farm cloud
</photo:subject>
</item>
Each rss channel must have one or more items. The <item> container holds information about an individual photograph. Above we have described an image I've titled Windmill Farm with Cloud. The image can be found at the URL between the <photo:imgsrc> and </photo:imgsrc> tags. Similarly there is a thumbnail available as described by the </photo:thumbnail> element. This information will be parsed and stored int the database where people can browse or search for the various fields. The URL in the <Link> tag is an address which will be presented as a clickable link pointing to page on the photographer's website related to this image. one of the many nice things about RSS (and XML in general) is that it is self-descriptive; it is easy to tell what the document is about just by looking at it. For more information about the individual elements click on the Pheed RSS extension link on the side.
<item>
<title>The Racetrack Playa</title>
<link>http://www.photo-mark.com/cgi-bin/set.cgi?set_id=7&n=1</link>
<description>The Racetrack Playa</description>
<category>In progress</category>
<dc:creator>Mark Meyer</dc:creator>
<dc:rights>Copyright 2003 Mark Meyer</dc:rights>
<dc:coverage>Death Valley National Park, California</dc:coverage>
<dc:format>4x5 Transparency</dc:format>
<photo:imgsrc>
http://www.photo-mark.com/webpix/ds/racetrack.jpg
</photo:imgsrc>
<photo:thumbnail>
http://www.photo-mark.com/webpix/tn/racetrack.jpg
</photo:thumbnail>
</item>
</channel>
</rss>
Your document can contain several items each representing individual images. When there are no more items, you wrap everything up by closing the <channel> and <rss> elements with their corresponding closing tags and you are done. Save the document on a webserver, tell us about it, and the infomation abot your images will be parsed and indexed in our database.
