Consider this first part of the code:

Line 3 is the rss feed which in this case is a standard google neews feed. Of course you can modify this by assigning your own RSS feed link to the $file variable.
In line 5 $rss_channel is initialised as an array. This array will contain all the data in the RSS/XML document feed .
The start element function is passed to xml_set_element_handler() below along with the following endElement function.

This next function determines which data we are interesrted in processing in the RSS feed:

Okay this is where it all kicks off :
In line 71 we create an $xml_parser and in line 72 we tell the parser how to handle elements in the RSS/XML feed by passing the callback functions startElement and endElement, defined above, to xml_set_element_handler(). In line 73 we provide the xml parser with function characterData above. This tells the parser how to deal with data, essentially non tags or elements but the data stored between the xml tags. In line 74 the rss feeed is opened and in line is read 'bit by bit' pardon the pun, until the eof( end of file is reached ). Lines 87 to 91 allow for development testing of what is contained in our array after the XML/RSS is parsed.
In the next piece of code we take our $rss_channel array and output it in HTML format.

What we do first is check if the rss feed has a Image in its title and if so output it with LINK URL and TITLE. If not we just output the TITLE of the RSS feed. We then, using the items-count output a link to more details on the item a title to the item and the item description.
To see this code function exactly as is above click here. To see a more user friendly end production use of this code click here. And of course to copy and paste the code click here.

