Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML and XMLList and XMLListCollection in Flex 3

Please explain me what is the difference between XML and XMLList and XMLListCollection. If possible in simple words with example. Thanks in advance.

like image 711
Kishor Kumar Avatar asked Jun 17 '11 13:06

Kishor Kumar


1 Answers

First, links to Flex 3 Language Reference - a must have bookmark for looking this stuff up.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html

XML

XMLList

XMLListCollection

Secondly, I'd say check the Examples link for XMLList as that gives a good working example between the difference of XML and XMLList.

Use XML when you want to create a variable with a value of an XML document.

var mybooks:XML = <books>
  <book>
    <title>Book1</title>
  </book>
  <book>
     <title>Book2</title>
  </book>
</books>;

Use XMLList to create subsets of data from an XML variable.

var mybookTitles:XMLList = mybooks.title;  

Finally, an XMLListCollection class is basically a helper class for taking your XML or XMLList object and using it in a control.

Take this snippet from mx.core.Repeater docs on its dataProvider property

If you set it to an XML or XMLList, it is converted into an XMLListCollection.

Hope this helps

like image 152
mrk Avatar answered Oct 04 '22 21:10

mrk