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<http://where.yahooapis.com/v1/places.q('%7BtxtCity.text%7D');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">
-
<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/>
-
<centroid>
<latitude>42.885441</latitude>
<longitude>-78.878464</longitude>
</centroid>
-
<boundingBox>
-
<southWest>
<latitude>42.824860</latitude>
<longitude>-78.942909</longitude>
</southWest>
-
<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