Flex XML 动态类型
我有一个从服务器接收动态 XML 数据的应用程序。 XML 的结构是动态的,标签/属性名称无法预测。没有行项目可以被硬编码。数据从数据库返回(想象列和行),并且数据的类型在服务器端是已知的。下面只是一个例子,仅展示数据返回的结构。
<dataset>
<row>
<firstName value="Chris" type="String"/>
<lastName value="McDonald" type="String"/>
<age value="24" type="Integer"/>
</row>
<row>
<firstName value="Bob" type="String"/>
<lastName value="Bourne" type="String"/>
<age value="43" type="Integer"/>
</row>
</dataset>
我想知道如何/是否可以将该数据放入数组集合中的键入值中,如下所示:
public var arr:ArrayCollection = new ArrayCollection(
[firstName:"Chris", lastName:"McDonald", age:24], ...); // Note that age is an integer, not a string
提前致谢
I have an application which receives dynamic XML data from a server. The structure of the XML is dynamic and the tags/attribute names cannot be predicted. NO row items can be hardcoded. The data is coming back from a database (imagine columns and rows), and the type of the data is known on the server side. The following is just an example, an only shows the structure of how the data comes back.
<dataset>
<row>
<firstName value="Chris" type="String"/>
<lastName value="McDonald" type="String"/>
<age value="24" type="Integer"/>
</row>
<row>
<firstName value="Bob" type="String"/>
<lastName value="Bourne" type="String"/>
<age value="43" type="Integer"/>
</row>
</dataset>
I am wondering how/if I can get that data into typed values in an arraycollection like this:
public var arr:ArrayCollection = new ArrayCollection(
[firstName:"Chris", lastName:"McDonald", age:24], ...); // Note that age is an integer, not a string
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,我认为你可以做到。看看这是否有帮助:
Yes I think you can do that. See if this helps: