.
Developer Spot - Web Development Tutorials
arrowDeverloper Spot  Tutorials  XML  Grab Headlines From A Remote RSS File 
 
Development Tutorials
ASP
CGI & Perl
CSS
HTML
Java
JavaScript
Linux
PHP
XML




More Resources
Web Hosting Articles
Web Development News
PHP Manual
Web Hosting Directory
Budget Web Hosting Linux Web Hosting Small Business Hosting
Windows Web Hosting Reseller Web Hosting Web Hosting Articles

Grab Headlines From A Remote RSS File

By Nicholas Chase
2003-12-19
Reader Rating: 4 out of 5
Bookmark Print Version
The Source File

Depending on whom you ask, RSS stands for RDF Site Summary, Rich Site Summary, or other acronyms that are less tactful. In any case, no fewer than four versions of RSS are in common usage, from the fairly simple 0.91, which doesn't include namespaces and imposes some strict limits on content, to version 2.0, which encompasses versions back to 0.91 (so a valid 0.91 file is also a valid 2.0 file) but also allows the use of namespaces. By allowing namespaces, version 2.0 makes it possible for a syndicator to add elements to the feed, as long as they're in a different namespace. Some syndicators use this capability to add information using Resource Definition Format (RDF).

A simple RSS 2.0 file might look like this feed from Adam Curry's weblog (see Resources):

Listing 1. A sample RSS 2.0 message
<?xml version="1.0"?>

<rss version="2.0">
<channel>
<title>Adam Curry: Adam Curry's Weblog</title>
<link>http://www.blognewsnetwork.com/members/0000001/</link>
<description>News and Views from Adam Curry</description>
<language>en-us</language>
<copyright>Copyright 2003 Adam Curry</copyright>
<lastBuildDate>Thu, 24 Jul 2003 09:26:48 GMT</lastBuildDate>
<docs>http://backend.userland.com/rss</docs>
<generator>Radio UserLand v8.0.9b2</generator>
<managingEditor>adam@curry.com</managingEditor>
<webMaster>adam@curry.com</webMaster>
<item>
<title>weblog at work again</title>
<link>
http://www.blognewsnetwork.com/members/0000001/2003/07/24.html#a4158
</link>
<description>&lt;a href="http://radio.weblogs.com/0001014/images/2003/07/24/ad
amwheely.jpg"&gt;&lt;img src="http://radio.weblogs.com/0001014/images/2003/07/24/
adamwheely.jpg" width="250" height="187.5" border="0" align="right" hspace="15" v
space="5" alt="A picture named adamwheely.jpg"&gt;&lt;/a&gt;A few days ago I aske
d if anyone had taken pictures of me at the annual ...</description>
<guid>
http://www.blognewsnetwork.com/members/0000001/2003/07/24.html#a4158
</guid>
<pubDate>Thu, 24 Jul 2003 09:21:25 GMT</pubDate>
</item>
<item>
<title>teens trouble with web</title>
<link>
http://www.blognewsnetwork.com/members/0000001/2003/07/23.html#a4156
</link>
<description>According to a report from Northumbria University, most teenagers
lack the &lt;a href="http://www.web-user.co.uk/news/news.php?id=33621"&gt;inform
ation gathering skills&lt;/a&gt; needed for using the internet efficiently. This
sounds like it shouldn't be happening in ...</description>
<guid>
http://www.blognewsnetwork.com/members/0000001/2003/07/23.html#a4156
</guid>
<pubDate>Wed, 23 Jul 2003 17:36:23 GMT</pubDate>
</item>
...
</channel>
</rss>


To turn this feed into HTML, you can process it using XSL transformations.


Article Pages:
Retrieve Syndicated Content, Transform It, & Display The Result
The Source File
The Primary Stylesheet
The Basic JSP Page
Transforming The File
Adjusting For Multiple Formats
Choosing A Version
Caching The Feed
Conclusion
Resources

First published by IBM developerWorks


 Rate this article:   Poor          Excellent 


If you found this article interesting, you may want to read these as well:

» Better SOAP Interfaces With Header Elements

» Variable Substitution In XML Documents

» Create JPEGs Automatically With SVG

» Tip: Convert from HTML to XML with HTML Tidy



 
Development Tutorials: CGI & Perl - CSS - HTML - Java - JavaScript - Linux - PHP - XML
More Resources: Web Hosting Articles - Web Development News - PHP Manual