Flash RSS Reader Pg.2

source: http://www.thegoldenmean.com

2 — Introducing RSS

XML

I’m not about to attempt a comprehensive exploration of what XML is. That is a very deep topic of study which extends far beyond the scope of this tutorial. For our present purposes my working definition follows. It is painfully superficial but it works for what we need to know for now.

XML (Extensible Markup Language) is a beautifully efficient and platform-independent means of structuring and exchanging data.

Its intent is to be human-readable. It is based on tags which can be nested in a tree-like heirarchy. If you are familiar with xHTML you will get the general idea quickly. Unlike xHTML which is constrained to a finite repertoire of tags, XML tags are defined by the user. It still must be “well-formed”, but it is far more open than xHTML.

Because it is platform-independent, XML has become an extremely important technology for internet applications, but it is certainly not limited to the internet. Indeed, my beloved Macintosh OS X makes extensive use of XML for everything from preference files to help documents and iTunes playlists. Macromedia’s Flash MX itself is built on an XML foundation.

An XML document might be as simple as the following. (This code fragment will actually reappear in page ten, so pay attention to it!) Note that all tags have to be closed, and the proper nesting of child nodes is critical.

<?xml version="1.0" ?>
<feeds>
  <feed>
     <menuLabel>Colin Moock</menuLabel>
    <linkURL>http://www.moock.org/’blog/index.rdf</linkURL>
  </feed>
  <feed>
     <menuLabel>Mike Davidson</menuLabel>
    <linkURL>http://www.mikeindustries.com/’blog/index.xml</linkURL>
  </feed>
</feeds>

RSS

What is RSS? Try this:

“RSS is a lightweight, multipurpose extensible metadata description and syndication format. RSS is an acronym for RDF Site Summary, Rich Site Summary or Real Simple Syndication. RSS is an XML application, conforms to the W3C's RDF Specification and is extensible via XML-namespace and/or RDF based modularization. What does this mean? Basically, it's a way to publish (syndication) data.”
(source: Ask Tom)

Although it does somewhat of a disservice to RSS, for our purposes here we can think of RSS as a “dialect” or sub-set of XML. It has its own specifications but it still needs to meet XML criteria for being well-formed. The purpose of RSS is to syndicate, to describe or summarize a body of content and distribute that summary. For our purposes today we are interested in the syndication of weblogs. We want a fast, easy means of skimming headlines from a collection of our favorite weblogs, getting a sense of the article’s content and having the option of reading the full content or moving on to something else.

As with XML, I have neither the space nor the depth of understanding to provide a comprehensive discussion of RSS. For the curious, Mark Pilgrim wrote a very lucid discussion of the history of RSS and a discussion of the seven (yes, seven!) versions of what we will from here on treat as simply “RSS”. Pilgrim’s article deals with building a news reader in the Python language, but his preliminary information is an excellent introduction. I warmly recommend you read Dive into XML.

Key Node of an RSS Document

Typical RSS documents contain a rich assortment of metadata. What you consider “key” therfore depends on what you are doing with the document. Being a practical sort, I have chosen to pay attention to only one node (“item”) and three child nodes of the item node(“title”, “link” and “description”). Happily, all current versions of RSS contain the item node and these three child nodes, though not necessarily in the following order:

Versions of RSS

All versions share some similarities but they organize their content differently. We will soon see why that matters and explore some strategies for dealing with that variety. Page four will present a skeleton form of a typical RSS 1 and 2 document.

What is Atom?

Atom is another version of syndication. At this time my project does not support Atom feeds. If it matters to you, by the end of this tutorial you should have the skills to parse Atom feeds yourself.

Assumptions

For all its seeming simplicity, the XML specification contains some very complex and technical conventions. We are going to totally ignore most of them in this tutorial. Put more bluntly, this tutorial blithely ignores namespaces and performs no error checking. The ’blog reader we will build assumes it is going to get well-formed XML. It will most likely fail in amusing and unexpected ways if this condition is not met. Fortunately, all the ’blogs I read regularly meet this condition. You have been warned.

Flash and Security Limits

Before we can begin to worry about processing an XML document we need to load it into a Flash movie. This is not so easily done due to the cross-domain security limitations Macromedia has built into Flash. Accordingly, the next page details building a bridge over the Security Sandbox.

go to page: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13
divider ornament

--top--