/** * Parses ATOM feeds and returns an indexed array with all elements * * @author Jeroen Wijering * @version 1.1 **/ import com.jeroenwijering.feeds.AbstractParser; import com.jeroenwijering.utils.StringMagic; class com.jeroenwijering.feeds.RSSParser extends AbstractParser { /** Contructor **/ function RSSParser(enc:Boolean,pre:String) { super(enc,pre); }; /** build an array with all regular elements **/ private function setElements() { elements = new Object(); elements["title"] = "title"; elements["guid"] = "id"; elements["author"] = "author"; elements["category"] = "category"; elements["link"] = "link"; elements["geo:lat"] = "latitude"; elements["geo:long"] = "longitude"; elements["geo:city"] = "city"; }; /** Convert RSS structure to array **/ private function parse(xml:XML):Array { var arr = new Array(); var tpl = xml.firstChild.firstChild.firstChild; while(tpl != null) { if (tpl.nodeName.toLowerCase() == "item") { var obj = new Object(); for(var j=0; j0){ obj["image"] = obj["file"]; } if(obj["author"] == undefined) { obj["author"] = ttl; } if(obj["type"] != undefined || enclosures == false) { arr.push(obj); } } else if (tpl.nodeName == "title") { var ttl = tpl.firstChild.nodeValue; } else if (tpl.nodeName == "geo:lat") { var lat = tpl.firstChild.nodeValue; } else if (tpl.nodeName == "geo:long") { var lng = tpl.firstChild.nodeValue; } tpl = tpl.nextSibling; } return arr; }; }