4 Replies Latest reply on Feb 8, 2010 10:39 PM by iamcootis

    Cannot parse Yahoo search results XML

    iamcootis Level 1

      I am trying to create an application that will query yahoo and return XML to parse and display on the screen. For some reason I cannot parse the XML. I have done it this way before, but for some reason it is not working now. Does anyone have any idea how to get this to work?


      When I debug the data I can see the XML values in the searchXML object, but I cannot retrieve them. I have attached the XML that is returned. It appears to be messing up with I copy and paste it from IE into a file.


      Also I have removed my appId from this application.




      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
          import mx.rpc.events.ResultEvent;
          import mx.core.IUIComponent;
          import mx.collections.XMLListCollection;
          private var searchURL:String = "";
          private var searchXML:XML = new XML();
          private function send_data():void
              searchURL ="http://boss.yahooapis.com/ysearch/web/v1/"+searchTerm.text+"?appid=APPID&format=xml";
              var str:String = searchURL;
          private function resultHandler(event:ResultEvent):void
              searchXML = event.result as XML;
              dgUserRequest.dataProvider =searchXML.resultset_web;
          <mx:HTTPService id="userRequest" url="{searchURL}" method="POST" result="resultHandler(event)" resultFormat="e4x"/>
              <mx:Label text="Enter Search Term" />
              <mx:TextInput id="searchTerm" />
              <mx:Button id="submit" label="Submit" click="send_data()"/>
              <mx:Label text="{searchURL}"/>
              <mx:Label id="thislabel" text="{searchXML.@responsecode}"/>
              <mx:Label text="{searchXML.resultset_web.@count}"/>
              <mx:DataGrid id="dgUserRequest" >
                      <mx:DataGridColumn dataField="abstract" headerText="About" width="300"/>
                      <mx:DataGridColumn dataField="clickurl" headerText="URL" width="300"/>