<?php
/*
 * Created on 11.02.2012
 * Oliver Soop(osoop1@ut.ee)
 */

 include_once("XMLBaseTagger.php");
 
 class RSSBaseTagger extends XMLBaseTagger {
 	
 	public static $rssTag = "rss";
 	public static $rssv10Tag = "rdf:RDF";
 	public static $version = "version";
 	public static $channelTag = "channel";
 	public static $itemTag = "item";
 	public static $titleTag = "title";
 	public static $linkTag = "link";
 	public static $pubDateTag = "pubDate";
 	public static $descriptionTag = "description";
 	public static $categoryTag = "category";
 	public static $authorTag = "author";
 	public static $languageTag = "language";
 	public static $guidTag = "guid";
 	
 	public function __construct() {
		//Tühikonstruktor
 	}
 	
 	/**
 	 * Funktsioon, mis parsib <item> märgendiga objekti Story objektiks
 	 */
 	public static function getStory($domElement) {
 		$title = parent::getTagValue($domElement->getElementsByTagName(RSSBaseTagger::$titleTag));
 		$pubDate = parent::getTagValue($domElement->getElementsByTagName(RSSBaseTagger::$pubDateTag));
 		$description = parent::getTagValue($domElement->getElementsByTagName(RSSBaseTagger::$descriptionTag));
 		$link = parent::getTagValue($domElement->getElementsByTagName(RSSBaseTagger::$linkTag));
 		$category = parent::getTagValue($domElement->getElementsByTagName(RSSBaseTagger::$categoryTag));
 		$author = parent::getTagValue($domElement->getElementsByTagName(RSSBaseTagger::$authorTag));

 		$story = new Story($title, $pubDate, $description, $link, null, $category, null);
 		if($author != null) {
 			$story->author($author);
 		}
 		return $story;
 	}
 	
 }
?>
