Can';t使用名称空间在flash中解析XML AS3

Can';t使用名称空间在flash中解析XML AS3,xml,actionscript-3,flash,e4x,Xml,Actionscript 3,Flash,E4x,我不明白为什么我不能解析这些数据: <places yahoo:start="0" yahoo:count="1" yahoo:total="1" xmlns="http://where.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"> <place yahoo:uri="http://where.yahooapis.com/v1/place/2342481

我不明白为什么我不能解析这些数据:

<places yahoo:start="0" yahoo:count="1" yahoo:total="1" xmlns="http://where.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng">

    <place yahoo:uri="http://where.yahooapis.com/v1/place/23424819" aaa:lang="en-US" xmlns:aaa="http://www.w3.org/XML/1998/namespace">
        <woeid>23424819</woeid>
        <placeTypeName code="12">Pays</placeTypeName>
        <name>France</name>
        <country type="Pays" code="FR" woeid="23424819">France</country>
        <timezone type="Fuseau Horaire" woeid="28350911">Europe/Paris</timezone>
    </place>
</places>

如何获取
woeid

由于root places节点声明了一个特定的名称空间,您需要在访问它之前告诉AS3使用该名称空间:

以下是一个例子:

//创建与places节点的命名空间匹配的命名空间
变量ns:Namespace=新名称空间(“http://where.yahooapis.com/v1/schema.rng");
//告诉AS3使用此名称空间作为默认名称空间
默认xml名称空间=ns;
变量xml:xml=
23424819
支付
法国
法国
欧洲/巴黎
;
//现在你所期望的一切都应该起作用了。
跟踪(xml.place[0].woeid);
如果您有很多名称空间,并且不想设置默认名称空间,也可以这样做:

trace(xml.ns::place.ns::woeid);
如果需要访问
yahoo
名称空间中的某些内容(如place节点的uri),可以执行以下操作:

var-yNs:Namespace=新名称空间(“http://www.yahooapis.com/v1/base.rng");
跟踪(xml.place@yNs::uri);

获取
位置时,您需要添加yahoo名称空间
请举个例子更精确一点,好吗?您能用您试图解析的完整xml编辑您的问题吗?该xml无论如何都是无效的。若你们要发布xml和代码示例,不要发布假的。无论如何,请查看这篇文章并向下滚动到名称空间部分:这不是假的,这是firefox日志,它解释了提要。
var xml:XML = new XML(e.currentTarget.data);
trace(xml); // => that is working it is print xml datas
trace (xml.places); // => nothing
trace (xml.place); // => nothing
trace (xml.place.woeid); // => nothing
trace (xml.place[0].woeid); // => nothing