jQuery - Parse RSS XML with jQuery

You can use the same jQuery traversal and selection methods for XML that you use for (X)HTML. this makes it very easy to parse an XML file and process it's contents if you already know jQuery.

Here's a quick example of an rss parsing script.

The XML file of course needs to be on the same domain or retrieved via a simple serverside proxy script, because of cross site scripting restrictions in JavaScript:

<script>
	var rssurl = 'nieuws.xml';
	$.get(rssurl, function(data) {
		var $xml = $(data);
		$xml.find("item").each(function() {
			var $this = $(this),
				item = {
					title: $this.find("title").text(),
					link: $this.find("link").text(),
					description: $this.find("description").text(),
					pubDate: $this.find("pubDate").text(),
					author: $this.find("author").text()
			}
			console.log(item)
		});
	});
</script>
Reply:
 
 
 
 
This is great for rss text data. What do you do about an image that is passed? How is it processed and added to a
for example?
rendered @ Sat Mar 29 4:24:15 CET 2014