Comparison between xmllistcollection and arraycollection objects

Source: Internet
Author: User

Use xmllistcollection to compare the arraycollection objects.

You may want to know whether the xmllistcollection object or arraycollection object should be used as the data provider of the tree space when the remotely or locally obtained data is dynamically modified during runtime.

If the data source you use provides the formed XML, and you want to operate the XML data in the tree control. You should use the xmllistcollection object as the data provider. When mxml is used for marking, if the data source is an xmllist object, you should bind it to the source attribute of the xmllsitcollection object, and then bind the xmllistcollection object to the dataprovider attribute of the tree control.

When you want to dynamically change the object value, do not bind the xmllist or XML object to the dataprovider attribute of the tree control directly. When the data source is the lastresult property of the RPC (Remote Procedure Call) service and you want to use XML data, make sure that the resultformat attribute of the RPC component is set to E4X. When you use the E4X result format, the final result is xmllist, which can be bound to an xmllistcollection object.

Here is an example. For example, the data is dynamically changed and the arraycollection object is used as the data provider of the tree control. When mxml is used for marking, if you want to dynamically change arrayl, you should not directly bind the array object to the dataprovider attribute of the tree control. Instead, you should bind an array to the source attribute of an arraycollection object, and then bind the arraycollection object to the dataprovider attribute of the tree control.

When the data source is the lastresult object of the RPC (Remote Procedure Call) service and the resultformat attribute of the RPC component is converted into an object, you should use arrayutil. toarray () method to ensure that the object is an array. Then bind it to the arraycollection object, as shown in the following example:

id = "employeeac"
source = "{arrayutil. toarray (employeesrv. lastresult. employees. employee)} "/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.