Actionscript 3 在AS3中读取RSS数据时出现问题

Actionscript 3 在AS3中读取RSS数据时出现问题,actionscript-3,flash,rss,Actionscript 3,Flash,Rss,我试图在flash中阅读一个简单的RSS提要,但不断遇到名称空间问题。从以下rss源获取内容url的正确方法是什么 <rss version="2.0" xmlns:rbinl="http://reedbusiness.nl/rss/2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> <item> <media:content url="how

我试图在flash中阅读一个简单的RSS提要,但不断遇到名称空间问题。从以下rss源获取内容url的正确方法是什么

<rss version="2.0" xmlns:rbinl="http://reedbusiness.nl/rss/2.0" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <item>
          <media:content url="howtogetthis.jpg"/>
          <title>This can be read from AS3</title>
        </item>
    </channel>

您需要引用媒体命名空间才能使用url访问该内容节点

以下是一个例子:

//get a reference to the media namespace
var ns:Namespace = new Namespace("http://search.yahoo.com/mrss/");

//use ns::content to get a reference to a `content` node in the media namespace
xml.channel.item[0].ns::content.@url;

请记住,名称空间是节点的前缀。因此,节点名称是内容,而不是媒体。

节点是
内容
,而不是媒体。媒体是名称空间
//get a reference to the media namespace
var ns:Namespace = new Namespace("http://search.yahoo.com/mrss/");

//use ns::content to get a reference to a `content` node in the media namespace
xml.channel.item[0].ns::content.@url;