demo_string.lua: Example opening a feed from a string

Fri, 17 Sep 2010 14:47:45 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 17 Sep 2010 14:47:45 +0100
changeset 2
c04d4fd34685
parent 1
ee74a5e9419b
child 3
ab02540afcf3

demo_string.lua: Example opening a feed from a string

demo_string.lua file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/demo_string.lua	Fri Sep 17 14:47:45 2010 +0100
@@ -0,0 +1,30 @@
+require "feeds"
+
+-- Example feed as a string (only a single entry in this example)
+local feed = feeds.feed_from_string [[<feed xmlns="http://www.w3.org/2005/Atom">
+        <title>Planet Jabber</title>
+        <!--<link rel="self" type="text/atom" href=""/>-->
+        <link rel="alternate" type="text/html" href="http://planet.jabber.org/"/>
+        <id></id>
+        <updated>2010-09-17T13:39:01+00:00</updated>
+        <generator uri="http://www.planetplanet.org/">http://intertwingly.net/code/venus/</generator>
+        <entry>
+                <title>Fabio Forno: Glider Blackberry Beta is out</title>
+                <link rel="alternate" type="text/html" href="http://blog.bluendo.com/ff/glider-blackberry-beta-is-out2"/>
+                <id>http://blog.bluendo.com/ff/glider-blackberry-beta-is-out2</id>
+                <updated>2010-09-15T12:26:10+00:00</updated>
+                <content type="html">&lt;p&gt;After a long silence (and hard work) we are really excited for the  release of the first beta of Glider for Blackberry. If you are impatient  you can go directly &lt;a href=&quot;http://www.mobihand.com/ProductPreview.asp?id=85809&amp;amp;gnContentType=1&quot;&gt;here&lt;/a&gt;  and download it.&lt;/p&gt;&lt;p&gt;This  beta version is free and it will expire when new releases will be  available. After the beta period you will have two options: a free ads  supported version and a full pro version at an affordable price. &lt;/p&gt;&lt;p&gt;Glider is the multiplatform XMPP Client by Ooros, based on the open code of Lampiro. Glider exclusive features are:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;touchscreen support&lt;/li&gt;&lt;li&gt;blackberry device integration&lt;/li&gt;&lt;li&gt;simplified setup&lt;br /&gt;&lt;/li&gt;&lt;li&gt;notifications of new messages when in background&lt;/li&gt;&lt;li&gt;automatic reconnect&lt;/li&gt;&lt;li&gt;network configuration&lt;/li&gt;&lt;li&gt;integrated news reader based on the efficient pubsub protocol &lt;br /&gt;&lt;/li&gt;&lt;li&gt;moneiro: the Ooros platform for mobile payments&lt;/li&gt;&lt;/ul&gt;Stay tuned, since very soon we will have news for Android and iPhone too!</content>
+                <author>
+                        <name>Fabio Forno</name>
+                        <uri></uri>
+                </author>
+        </entry>
+</feed>]];
+
+print(feed.title);
+print("");
+
+for _, entry in ipairs(feed) do
+	print(entry:get_child("title"):get_text());
+	print("", entry:get_child("link").attr.href);
+end

mercurial