I am not very good with XML (That's Tracy's expertise) but you can get it with 
the following:

myXML..woeid
myXML[0]..woeid

and probably a dozen different ways.

You may like to check these out for more detail...

http://www.adobe.com/devnet/flex/quickstart/accessing_xml_data/
http://livedocs.adobe.com/flex/3/langref/XML.html

--- In [email protected], "Sneha" <bhansal...@...> wrote:
>
> Hello All,
> 
> Can anybody help me find out the bug in my program which doesn't read 
> children in an XML file. 
> 
> I am trying to get WOEID of the location provided from Yahoo webservice API. 
> I have given below what I am doing and also the XML file generated from Yahoo.
>  
> <mx:HTTPService
> id="weatherService" 
> url = "
> http://where.yahooapis.com/v1/places.q('{txtCity.text}');start=0;count=1?appid=your
>  AppID" 
> result="getWOEID(event)" fault="faultEventHandler(event)"
> resultFormat="
> e4x"/> 
>  
> This is what I am doing in Script tag. But nothing works. I am able to read 
> the complete XML file but not the children of an XML file. Could someone help 
> find the problem.
> private
> function init():void{ 
> var city:String = txtCity.text;
> //Alert.show("Your City:"+city); 
> weatherService.cancel();
> //var params:Object = new Object(); 
> //params.q = city; 
> //Alert.show("params.q"+params.q); 
> //weatherService.send(params); 
> weatherService.send();
> } 
> private function getWOEID(event:ResultEvent):void{ 
> var myXML:XML = XML(event.result); 
> taXML.text = myXML;
> var cityList:XMLList = myXML.data.place.children();
> Alert.show(
> "getting woeid:" +cityList); 
> //taXML = cityList.toString(); 
> //cityList = myXML.places.place.name ; 
> //cityList = myXML.place.woeid;
> //Alert.show("in getWOEID() " +cityList); 
> //lblWOEID.text = cityList; 
> }
> This is the XML file generated and I am interested in accessing <woeid>: 
> 
> <places yahoo:start="0" yahoo:count="1" yahoo:total="55">
> &#8722;
> <place yahoo:uri="http://where.yahooapis.com/v1/place/2371464"; 
> xml:lang="en-us">
> <woeid>2371464</woeid>
> <placeTypeName code="7">Town</placeTypeName>
> <name>Buffalo</name>
> <country type="Country" code="US">United States</country>
> <admin1 type="State" code="US-NY">New York</admin1>
> <admin2 type="County" code="">Erie</admin2>
> <admin3/>
> <locality1 type="Town">Buffalo</locality1>
> <locality2/>
> <postal/>
> &#8722;
> <centroid>
> <latitude>42.885441</latitude>
> <longitude>-78.878464</longitude>
> </centroid>
> &#8722;
> <boundingBox>
> &#8722;
> <southWest>
> <latitude>42.824860</latitude>
> <longitude>-78.942909</longitude>
> </southWest>
> &#8722;
> <northEast>
> <latitude>42.970741</latitude>
> <longitude>-78.771393</longitude>
> </northEast>
> </boundingBox>
> </place>
> </places>
> 
> Any help would be appreciated.
>  
> Thank you
>  
> Sneha
>


Reply via email to