-
Notifications
You must be signed in to change notification settings - Fork 10
/
README
73 lines (42 loc) · 2.56 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
****** N O T E *******
Running this main.lua will result in a BLACK SCREEN in the simulator. This is on purpose. Please read this paragraph
if you don't read anything else!!!! I have no idea what your going to do with the data. This project isn't about
displaying an RSS feed. It's about **PARSING** an RSS feed and giving you a table of the results. As such, I only
data to the console. It's up to you to figure out what to do with it. Create buttons, a tableView or a swirling animation
of the story headlines. That's all on you.
******** NOTE #2 -- Please read this second paragraph!!!! *********
This project includes code to parse two different feeds: RSS2.0 and Atom. The sample in main.lua is currently set to call
the Atom processor, not the RSS2.0 procesor. If you want to feed this an RSS2.0 feed, please change line 50 on main.lua to
processRSSFeed()
instead of
processAtomFeed()
It will save you a lot of headache in the end.
This is the new version of the RSS reader for Corona SDK.
It's a much more simplified project eliminating all of the UI bits that seemed to confuse people.
Files now include:
main.lua -- a sample on how to use it, including network download code.
utility.lua -- contains the wonderful PHP style print_r function
rss.lua -- the feed parser. It has been updated to return the entire feed, not just the items list
xml.lua -- required to parse the RSS file.
Usage:
However you want, download the RSS file you want to parse and store it in one of your sandbox file directories such as:
system.TemporaryDirectory
system.DocumentsDirectory
or preferably
system.CachesDirectory
You need the latest daily build (721) to fully use the system.CachesDirectory since network.download didn't know how to until that daily build.
Then simply call the RSS parser:
local myfeed = rss.feed(feedFileName, feedPath)
such as:
local myfeed = rss.feed("index.rss", system.CachesDirectory)
and you will be returned a Lua table into myfeed.
The table will have entries for each thing returned in the RSS feed, like
myfeed.title
myfeed.link
etc.
The list of items is a table in myfeed called items:
stories = myfeed.items
then each entry in that table have the various fields for each field.
It should be noted that the Dublin Core creator field is supported and its put into the myfeed.dc_creator field.
The content namespace field is supported on individual items only as in myfeed.items[i].content_encoded.
No other namespace is supported at this time. Though I may add in limited supoort for some media and iTunes name spaces in the future.