Hey all - confused a bit by how best to use namespace.

I've got a flex application and am using an rss parser in an external class.

The rss has 2 different namespaces (it's the brighcove rss). I'm assuming I put the namespaces variables in the class -- and am parsing the items into a variable called 'episodes' -- how then do I get the needed elements I'd need? Class and example of xml item:


XML RSS ITEM:

<item>
            <title>PGA  - "The Old Lions Roar"</title>
<link>http://link.brightcove.com/services/link/bcpid1439819625/bclid930119542/bctid1407927614?src=mrss </link> <description>DoubleClick founder Kevin Ryan and former Merrill Lynch Internet stock analyst Henry Blodget discuss trends in the the tech industry and what producers can expect in a volitile marketplace</description> <guid>http://link.brightcove.com/services/link/bcpid1439819625/bclid930119542/bctid1407927614?src=mrss </guid>
            <pubDate>Thu, 07 Feb 2008 13:55:49 -0800</pubDate>
<media:content medium="video" type="video/x-flv" url="http://brightcove.vo.llnwd.net/d5/unsecured/media/29794487/29794487_1409022817_4df1dff23eafb105120e49cd80dd3224b8222adb.flv "/> <media:player height="620" url="http://link.brightcove.com/services/link/bcpid1439819625/bclid930119542/bctid1407927614?src=mrss " width="790"/> <media:keywords>pga,Silicon Alley Outsider,blog,Merrill Lynch,DoubleClick,Kevin Ryan,Henry Blodget</media:keywords> <media:thumbnail height="90" url="http://brightcove.vo.llnwd.net/d5/unsecured/media/29794487/29794487_1408983914_65e92c6a9ffbe54794e804dbaae541c61964afa6.jpg?pubId=29794487 " width="120"/> <media:thumbnail height="360" url="http://brightcove.vo.llnwd.net/d5/unsecured/media/29794487/29794487_1408984470_ed8142599114fca8c5843193c72f23b8d0dcde79.jpg?pubId=29794487 " width="480"/> <media:category>11 ScribeMedia.Org - Producers Guild of America</media:category>
            <bc:playerid>1439819625</bc:playerid>
            <bc:lineupid>930119542</bc:lineupid>
            <bc:titleid>1407927614</bc:titleid>
        </item>






CLASS:

package com.sm.xml
{
        import flash.events.*;
        import flash.net.*;
        
        public class BrightCoveRSS extends EventDispatcher
        {
                private var xmlLoader:URLLoader;
                public var feed:XML;
                public var episodes:XMLList;
                public var title:String;
                public var description:String;
                public var nsMedia:Namespace;
                public var nsBC:Namespace;

                public function BrightCoveRSS()
                {
                        xmlLoader = new URLLoader();
                }
                
                public function load(xmlReq:URLRequest):void
                {
                        xmlLoader.load(xmlReq);
                        xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
                }
                
                private function xmlLoaded(event:Event):void
                {
                        feed = new XML(xmlLoader.data);
                        nsMedia = feed.namespace("media");
                        nsBC = feed.namespace("bc");
                        episodes = feed..item;
                        title = feed.channel.title;
                        description = feed.channel.description;
                        dispatchEvent(new Event(Event.COMPLETE));
                }
                
                
                public function test():void
                {
                        trace(episodes.nsMedia::content);
                }
                
                
                
        }
}

Reply via email to