tags:

views:

333

answers:

2

On ResultEvent through HTTPService, i need to print the result in a textBox.

private function google(evt:ResultEvent):void {

Alert.show(evt.result.loginsuccess.person);

subtitle.text = evt.result.loginsuccess.person.keyword;

    }

This is my XML coming down from PHP file... [index.php]

<loginsuccess><person><keyword>java</keyword><name>http://www.xml.com/&lt;/name&gt;&lt;occur&gt;4&lt;/occur&gt;&lt;/person
><person><keyword>java</keyword><name>http://www.sitepoint.com&lt;/name&gt;&lt;occur&gt;2&lt;/occur&gt;&lt;/person&gt;&lt;person
><keyword>java</keyword><name>http://www.httpguru.com&lt;/name&gt;&lt;occur&gt;2&lt;/occur&gt;&lt;/person&gt;&lt;/loginsuccess&gt;
+1  A: 

You do not need to reference the top level node in the XML. So if you do evt.result.person.keyword; then that will display the 3 results.

Someone else
Nope its not working, i am not getting while doing an alert.
Someone else
+1  A: 

as the above answer but if you wish to get a specific value you can do evt.result.person.keyword[0] (this will give you the first value). Someone else's answer would give you the XML 3 times, but specifying which keyword node you wish to get will return just the value inside that node (i.e. 'java')

as an aside I've just had a look at your profile, do you know that after you've asked a question and then liked one of the answers you can mark that answer as correct. None of the 9 question with 30+ answers you've asked have been flagged as answered, has nobody answered any of your questions appropriately!

kenneth
I dont get the perfect riposte sometimes, i am new as in other communities i don't mark as you said.
Alert.show(event.result.person.keyword[0]);I am not getting an alert itself, for the above one.
it should work, I copied your XML from above and did the following just to make sure I was right.var xml : XML = new XML('<loginsuccess><person><keyword>java</keyword><name>http://www.xml.com/</name><occur>4</occur></person><person><keyword>java</keyword><name>http://www.sitepoint.com</name><occur>2</occur></person><person><keyword>java</keyword><name>http://www.httpguru.com</name><occur>2</occur></person></loginsuccess>');ta.text = xml.person.keyword[0];//ta is just a textArea.
kenneth
Have specified the result format (resultFormat="e4x") inside your httpService?
kenneth