Once you have determined using the hasElement or getElementList methods that a child element exists, you can use other DOMIT! RSS methods to query it for data.
Unlike the DOM specification, which delineates a standard API for accessing data in an XML tree, the RSS spec is unaccompanied by a standardized set of methods. This is one of the main impediments not only to building an RSS parser, but to programming with and communicating to others about RSS.
DOMIT! RSS is in part an attempt to carve out a sensible structure for thinking about RSS programatically.
In addition to the channel and item elements discussed above -- which are stored in specially indexed arrays named domit_rss_channels and domit_rss_items -- DOMIT! RSS proposes four different types of elements that can found in an element list:
Simple RSS Elements - elements defined by the RSS spec, composed of a single child text node and no attributes. For example:
<language>en-us</language>
All Simple RSS Elements can be accessed using the same set of methods.
The following elements are considered Simple RSS Elements: 'title', 'link', 'description', 'language', 'copyright', 'managingEditor', 'webmaster', 'pubDate', 'lastBuildDate', 'generator', 'docs', 'ttl', 'rating', 'lastBuildDate', 'author', 'comments', 'pubDate', 'skipHours', and 'skipDays'.
Complex RSS Elements - elements defined by the RSS spec, that contain attributes and/or child elements. For example:
<image>
<title>Developer</title>
<link>http://www.internetnews.com</link>
<url>http://www.engageinteractive.com/domit/domitBanner.gif</url>
<width>150</width>
<height>50</height>
<description>The blah blah blah de blah</description>
</image>
Complex RSS Elements have methods specific to their unique structure.
The following elements are considered Complex RSS Elements: 'generator', 'cloud', 'image', 'textInput', 'enclosure', 'source', 'guid'.
Custom RSS Elements - any element that is not defined by the RSS spec. For example:
<dc:creator>John Heinstein</dc:creator>
Custom RSS Elements are treated as DOM nodes and can be queried using the standard DOM methods.
Collections of Custom RSS Elements - multiple instances of custom RSS elements at the same level of hierarchy. For example:
<dc:creator>John Heinstein</dc:creator>
<dc:creator>Brad Parks</dc:creator>
<dc:creator>Liz Goulard</dc:creator>
Custom RSS Collections have methods which allow you to iterate through and obtain references to the members of the collection, after which the methods of Custom RSS Elements can be used.
|