Once a DOMIT! RSS document is instantiated, a number of methods become available:
getVersion
The version of DOMIT! RSS can be obtained with the getVersion method:
echo $rssdoc->getVersion();
//prints out '0.1'
getRSSVersion
You can also get the version of the RSS feed using the getRSSVersion method:
echo $rssdoc->getRSSVersion();
//prints out an RSS version number such as '0.91' or '2.0'
parsedBy
The parsedBy method indicates whether DOMIT! RSS or DOMIT! RSS Lite was used to parse a particular feed:
echo $rssdoc->parsedBy();
//prints out either 'DOMIT RSS' or 'DOMIT RSS Lite'
getChannelCount
Although officially, only a single channel is allowed in an RSS document, in common practice more than one channel is occasionally inserted. The getChannelCount method allows you to determine how many channels exist in an RSS document, allowing you to programmatically loop through each channel and extract information:
$numChannels = $rssdoc->getChannelCount();
Prior to grabbing a reference to the childNodes array, you can also check if any child nodes exist, by using the hasChildNodes() method:
if ($cdCollection->documentElement->hasChildNodes()) {
$myChildNodes =& $cdCollection->documentElement->childNodes;
}
getChannel
Once you have determined the number of channels that exist in an RSS document, you can obtain a reference to a particular channel using the getChannel method:
$firstChannel =& $rssdoc->getChannel(0);
Once a channel reference has been obtained, you can use the DOMIT! RSS methods of that channel to extract channel-specific data.
|