jQuery.atomfeed
A lightweight atom feed parser based on jQuery.
Features
jQuery.atomfeed provides the following:
- Read atom feeds and display easily.
- Support template, that you can customize a more readable format.
Getting Started
Here is a demo.
Options
- url (required)
- Specify the url for the feed.
- max (optional)
- Specify the maximum number of feed items to display. The default value is 10.
- template (optional)
- Specify the template. The default value is following:
'<dt>{updated}</dt><dd><a href="{link.href}">{title}</a></dd>'
Template syntax
- {TagName} will substitute the combined text contents of the element.
- {TagName.AttributeName} will subsitute the attribute value for the element.
Basic usage
The following example shows how to use atomfeed().
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Examples of jQuery.atomfeed</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="../jquery.atomfeed.min.js"></script>
<script>
$(document).ready(function(){
$('#target').atomfeed({
url: 'feed.atom'
});
});
</script>
</head>
<body>
<h1>Examples of jQuery.atomfeed sample</h1>
<dl id="target"></dl>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<link href="http://example.org/"/>
<updated>2003-12-13T18:30:02Z</updated>
<author><name>John Doe</name></author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
<entry>
<title>Atom-Powered Robots Run Amok</title>
<link href="http://example.org/2003/12/13/atom03"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2003-12-13T18:30:02Z</updated>
<summary>Some text.</summary>
</entry>
</feed>