AS: Main ain't Noise Pollution
Preferred Reading
AS: XML by Inglor
AS: Numerics - Recursion by Sekky (not required, but know what recursion means)
What is RSS?
no matter how you want to try to get around it, you still have to explain the acronym, so why dont we get that out of the way. RSS stands for "really simple syndication". but what does that mean? well, RSS is really the bastard child (read: a variant of) XML used for news feeds. pretend, if you will, that XML is the english language. RSS would be your accent (clearly 1.0 is a british accent and 2.0 is an american, or preferably non-regional, accent).
speaking of version numbers, at the time of writing this, there exist five distinct versions of RSS. the good news? all but two of them are obsolete and are no longer in use. all that remains is the charred rubble of a once great netscape empire and two versions of RSS: 1.0 and 2.0.
But why should I care?
because i told you to, so shut your mouth. the actual answer is that RSS is very simple to load into flash because RSS conforms to certain standards and conventions. in RSS 1.0, which is generally viewed in a format called RDF (raw data file) and uses tags such as <rdf:content>. RSS 2.0 (which is easier to read plaintext) is usually viewed in XML format and uses tags such as <description> and <pubDate>.
and what makes things better? the most common tags that you would be interested in (title, content, link) are all standard across RSS 1.0 and 2.0, meaning that if you look for the tag <content>, it will exist in both. what makes things worse? you have to look in different places.
So heres where the learning begins
To follow along, you can download my RSS.as class
Traversing the feed with Recursive Node Reading
Each feed starts off with some header tags to give information to RSS aggregators about the feed data and sources. These can be skipped for our purposes. If you look in the function sortFeed(), you can see that we immediately go down to the second child node for RSS 1.0, third child for RSS 2.0 (a bit of difference in header tags). Then we begin viewing the feed object by object.
in both forms of RSS, posts are seperated into tags called <item>. therefore, we can find what we are looking for by checking nodeType (1 means tag, 3 means text) and nodeName (== "item"). when we find an item tag, we send that entire node to another function to store everything we can about it. this makes recalling the info with both array notation and object properties simple.
by using my RSS.as and some cleverly applied components, you could create something like this RSS reader. (note: at the time of writing this, a few of the feeds are down. the only ones working are the macromedia ones and about 2 or 3 others)
