[185013] Remove use of xml_sax_parsing.php in favour of SimpleXml in Callisto Pages
https://bugs.eclipse.org/bugs/show_bug.cgi?id=185013
diff --git a/scripts/whatsnew.php b/scripts/whatsnew.php
index 4ab9cfc..c0f6611 100644
--- a/scripts/whatsnew.php
+++ b/scripts/whatsnew.php
@@ -1,11 +1,9 @@
 <?php  require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/xml_sax_parsing.php");
 
 function & get_news($file_name) {
-	$news_file = $file_name . ".rss";
-	$file_name = $_SERVER['DOCUMENT_ROOT'] . "/callisto/scripts/" . $news_file;
-	$handler = new RssFileHandler();
-	parse_xml_file($file_name, $handler);
-	return $handler->feed;
+	$file_name = $_SERVER['DOCUMENT_ROOT'] . "/callisto/scripts/" . $file_name . ".rss";
+	$rss = simplexml_load_file($file_name);
+	return $rss;
 }
 
 function rss_to_html($file_name, $count=3) {
@@ -22,7 +20,7 @@
 		foreach ($channel->item as $item) 
 		{
 			if ($count == 0) break;
-			$then = $item->pubDate;
+			$then = strtotime($item->pubDate);
 			$stringDate = date("M d, Y", $then);
 			?>
 				<li><a href="<?=$item->link;?>"><?=$item->title;?></a></li>
@@ -65,264 +63,6 @@
 	ob_end_clean();
 	return $html;
 }
-/*
- * Instances of the Feed class represent an RSS file.
- */
-class Feed {
-	var $channel;
-	
-	function Feed() {
-		$this->channel = array();
-	}
-	
-	function add_channel(&$channel) {
-		array_push($this->channel, $channel);
-	}
-}
-
-/*
- * Instances of the Channel class represent a channel in the RSS file.
- */
-class Channel {
-	var $title;
-	var $link;
-	var $description;
-	var $image;	
-	var $item;
-	
-	function Channel() {
-		$this->item = array();
-	}
-	
-	function add_item(&$item) {
-		array_push($this->item, $item);
-	}
-}
-
-/*
- * Instances of the Image class represent an image (presumably) on an
- * image. We don't currently use this information.
- */
-class Image {
-	var $url;
-	var $title;
-	var $link;
-}
-
-/*
- * Instances of the Item class represent an item in a channel.
- */
-class Item {
-	var $title;
-	var $link;
-	var $description;
-	var $pubDate;
-}
-
-
-/*
- * The rest of the code in this file is concerned with reading XML
- * into an object format. Once we update to PHP 5, we can get rid of
- * all of this junk and just use the simpleXML apis.
- */
-
-/*
- * The RssFileHandler represents the file being parsed. It does
- * only one thing: provides a handler for the contents of the
- * the file.
- */
-class RssFileHandler extends XmlFileHandler {
-	var $feed;
-	/*
-	 * This method returns the root handler for a RSS file
-	 * The root handler essentially represents the file itself
-	 * rather than any actual element in the file. The returned
-	 * element handler will deal with any elements that may occur
-	 * in the root of the XML file.
-	 */
-	function get_root_element_handler() {
-		return new RssRootHandler();
-	}
-
-	function end_root_element_handler($handler) {
-		$this->feed = & $handler->feed;
-	}
-}
-
-/*
- * The RssRootHandler class takes care of the root element 
- * in the file. This handler doesn't correspond to any particular
- * element that may occur in the XML file. It represents the file
- * itself and must deal with any elements that occur at the root
- * level in that file.
- */
-class RssRootHandler extends XmlElementHandler {
-	var $feed;
-
-	/*
-	 * This method handles the <rss>...</rss> element.
-	 */
-	function & get_rss_handler($attributes) {
-		$retVal = new RssHandler();
-		return $retVal;
-	}
-
-	function end_rss_handler($handler) {
-		$this->feed = & $handler->feed;
-	}
-}
-
-/*
- * The FeedHandler class takes care of the root element in the file.
- */
-class RssHandler extends XmlElementHandler {
-	var $feed;
-	
-	function RssHandler() {
-		$this->feed = new Feed();
-	}
-	
-	/*
-	 * This method handles the <channel>...</channel> element.
-	 */
-	function & get_channel_handler($attributes) {
-		$retVal = new ChannelHandler();
-		return $retVal;
-	}
-
-	function end_channel_handler($handler) {
-		$this->feed->add_channel($handler->channel);
-	}
-}
-
-class ChannelHandler extends XmlElementHandler {
-	var $channel;
-	
-	function ChannelHandler() {
-		$this->channel = new Channel();
-	}
-	
-	/*
-	 * This method handles the <title>...</title> element.
-	 */
-	function & get_title_handler($attributes) {
-		$retVal = new SimplePropertyHandler($this->channel, "title"); 
-		return $retVal;
-	}
-	/*
-	 * This method handles the <link>...</link> element.
-	 */
-	function & get_link_handler($attributes) {
-		$retVal =  new SimplePropertyHandler($this->channel, "link");
-		return $retVal;
-	}
-	/*
-	 * This method handles the <description>...</description> element.
-	 */
-	function & get_description_handler($attributes) {
-		$retVal = new SimplePropertyHandler($this->channel, "description");
-		return $retVal;
-	}
-	
-	/*
-	 * This method handles the <title>...</title> element.
-	 */
-	function & get_item_handler($attributes) {
-		$retVal = new ItemHandler();
-		return $retVal;
-	}
-	
-	function end_item_handler($handler) {
-		$this->channel->add_item($handler->item);
-	}
-	
-	/*
-	 * This method handles the <image>...</image> element.
-	 */
-	function & get_image_handler($attributes) {
-		$retVal = new ImageHandler();
-		return $retVal;
-	}
-	
-	function end_image_handler($handler) {
-		$this->channel->image = $handler->image;
-	}
-}
-
-class ItemHandler extends XmlElementHandler {
-	var $item;
-	
-	function ItemHandler() {
-		$this->item = new Item();
-	}
-	
-	/*
-	 * This method handles the <title>...</title> element.
-	 */
-	function & get_title_handler($attributes) {
-		$retVal = new SimplePropertyHandler($this->item, "title");
-		return $retVal;
-	}
-	/*
-	 * This method handles the <link>...</link> element.
-	 */
-	function & get_link_handler($attributes) {
-		$retVal = new SimplePropertyHandler($this->item, "link");
-		return $retVal;
-	}
-	/*
-	 * This method handles the <description>...</description> element.
-	 */
-	function & get_description_handler($attributes) {
-		$retVal = new SimplePropertyHandler($this->item, "description");
-		return $retVal;
-	}
-	
-	/*
-	 * This method handles the <pubDate>...</pubDate> element.
-	 */
-	function & get_pubdate_handler($attributes) {
-		$retVal = new SimpleTextHandler();
-		return $retVal;
-	}
-	
-	function end_pubdate_handler($handler) {
-		$value = trim($handler->text);
-		if (strlen($value)>0) {
-			$this->item->pubDate = strtotime($value);
-		}
-	}
-}
-
-class ImageHandler extends XmlElementHandler {
-	var $image;
-	
-	function ImageHander() {
-		$this->image = new Image();
-	}	
-		
-	/*
-	 * This method handles the <title>...</title> element.
-	 */
-	function & get_title_handler($attributes) {
-		$retVal = new SimplePropertyHandler($this->image, "title");
-		return $retVal;
-	}
-	/*
-	 * This method handles the <url>...</url> element.
-	 */
-	function & get_url_handler($attributes) {
-		$retVal = new SimplePropertyHandler($this->image, "url");
-		return $retVal;
-	}
-	/*
-	 * This method handles the <link>...</link> element.
-	 */
-	function & get_link_handler($attributes) {
-		$retVal = new SimplePropertyHandler($this->image, "link");
-		return $retVal;
-	}
-}
 
 
 ?>