I don't understand why I can't parse these datas:
<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>
I want to get woeid (23424819) This is the full xml data, sorry the was an error on >places>
I tried: ...
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
How can I get the woeid
?
Since the root places node declares a specific namespace, you need to tell AS3 to use that namespace before accessing it:
Here is an example:
If you have lots of namespaces, and don't want to set the default, you can also just do this:
If you needed to access something in the
yahoo
namespace (like the uri of the place node), you could do the following: