问题描述
请解释一下 XML 与 XMLList 和 XMLListCollection 之间的区别.如果可能的话,用简单的话举例.提前致谢.
Please explain me what is the difference between XML and XMLList and XMLListCollection. If possible in simple words with example. Thanks in advance.
推荐答案
首先,链接到 Flex 3 语言参考 - 必须有书签才能查找这些内容.
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
其次,我会说检查 XMLList 的 Examples
链接,因为它提供了一个很好的 XML 和 XMLList 差异之间的工作示例.
Secondly, I'd say check the Examples
link for XMLList as that gives a good working example between the difference of XML and XMLList.
当您想使用 XML 文档的值创建变量时,请使用 XML.
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>;
使用 XMLList 从 XML 变量创建数据子集.
Use XMLList to create subsets of data from an XML variable.
var mybookTitles:XMLList = mybooks.title;
最后,XMLListCollection 类基本上是一个辅助类,用于获取您的 XML 或 XMLList 对象并在控件中使用它.
Finally, an XMLListCollection class is basically a helper class for taking your XML or XMLList object and using it in a control.
从 mx.core.Repeater
文档中的 dataProvider
属性中获取此代码段
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.
希望能帮到你
这篇关于Flex 3 中的 XML 和 XMLList 和 XMLListCollection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!