String 转换为 ArrayCollection 请帮忙!该怎么解决
String 转换为 ArrayCollection 请帮忙!!!XML coderootnodetime0:0-1:0/timetypeWORD文档/type
String 转换为 ArrayCollection 请帮忙!!!
XML code<root> <node> <time>0:0-1:0</time> <type>WORD文档</type> <fName>Hibernate测试题.doc</fName> </node><node> <time>1:1-2:0</time> <type>PDF文档</type> <fName>JAVA测试题.doc</fName> </node></root> 上面的代码其实是一段String,我想是不是先要转换为xml 然后转换为 ArrayCollection ,具体怎么处理,请高手帮忙啊,急死了!!!!
[解决办法] 转成xml
按如下处理。
var xmlListCollection:XMLListCollection=new XMLListCollection();
xmlListCollection.source=转换后的xml;
var ac:ArrayCollection=new ArrayCollection(xmlListCollection.toArray());
[解决办法] var xml:XMLList=new XMLList(s);
直接new 一个试试,s就是字符串;
[解决办法] var xmllist:XMLList=XMLList(s);//可以直接转换
探讨 var xmlListCollection:XMLListCollection=new XMLListCollection(); xmlListCollection.source=xmllist; var ac:ArrayCollection=new ArrayCollection(xmlListCollection.toArray());[解决办法] var a:string=<root>
<node>
<time>0:0-1:0</time>
<type>WORD文档</type>
<fName>Hibernate测试题.doc</fName>
</node>
<node>
<time>1:1-2:0</time>
<type>PDF文档</type>
<fName>JAVA测试题.doc</fName>
</node>
</root>
var b:arraycollection=a as arraycollection