Looking at a Basic Feed


To tie together everything you have learned so far, the following code is a stripped-down feed from ZDNet's Web Services channel. Recall from earlier that XML's structure can be used to describe any given entity's logical structure in a hierarchical format. In ZDNet's case, we are talking about articles of some sort so you would expect, among other things, to see tag elements like title, language, and description because the XML will be used to describe the properties of an article. Of course, you don't have to take my word for it; you can take a look for yourself:

 <rss version="0.91"> <channel> <title>ITPapers.com - Recent Web Services White Papers</title> <description>Recent Web Services White Papers Added to ITPapers.com</description> <language>en-us</language> <item> <title>MSDN Webcast: How to Design Your Web Services For Successful Interoperability</title> <link>http://www.itpapers.com/abstract.aspx?scid=436&amp;docid=117431&amp;tag=rss&a mp;promo=100112</link> <description>Beginning in early design stages and throughout the development process, you must make decisions that affect the ability of your Web service to interoperate. Join us for this webcast as we offer proven strategies for maximum interoperability and highlight what practices to avoid while designing and building interoperable Web services. </description> </item> <item> <title>MSDN Webcast: Web Services (Level 300)</title> <description>Web Services offer a vision of interoperability between multiple platforms, applications and vendors. But what is the reality? What are the tips and tricks for developing seamless Web Services between Microsoft .NET, IBM WebSphere and BEA WebLogic? How are vendors contributing to the WS-* process, and what does this mean to you? In this Webcast we'll answer these questions and more - showing the promise of interoperability using Web Services and discussing best practices for implementing these in your own applications. </description> </item> </channel> </rss> 

In this example, rss is the root-level element, and the version for it is 0.91. The first six elements (up to and including language) introduce the feed, its homepage, and the language in which it is provided. These elements introduce the whole feed, like a header. The feed has a repeating element entitled item, and each story is contained within its own item tag. Each item tag contains the same three elements: title, link, and description. According to the RSS specification, the channel element can have any number of item elements (though a maximum of 15 is recommended) so the feed can provide a large number of stories to interested parties. That's pretty much it — quite simple really! In the next chapter you learn how to make use of web feeds such as this one, but first take a quick look at the formatting behind the common feeds.




Professional Web APIs with PHP. eBay, Google, PayPal, Amazon, FedEx, Plus Web Feeds
Professional Web APIs with PHP. eBay, Google, PayPal, Amazon, FedEx, Plus Web Feeds
ISBN: 764589547
EAN: N/A
Year: 2006
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net