Flex XMLListCollection sort on nested tags
I have a requirement of sorting the <ename>
in the XML with in the branch. The XML goes like this:
<company>
<branch>
<name>finance</name>
<emp>
<ename>rahul</ename>
<phno>123456</phno>
</emp>
<emp>
<ename>sunil</ename>
<phno>123456</phno>
</emp>
<emp>
<ename>akash</ename>
<phno>123456</phno>
</emp>
<emp>
<ename>alok</ename>
<phno>123456</phno>
</emp>
</branch>
<branch>
<name>finance</name>
<emp>
<开发者_StackOverflow;ename>sameer</ename>
<phno>123456</phno>
</emp>
<emp>
<ename>rahul</ename>
<phno>123456</phno>
</emp>
<emp>
<ename>anand</ename>
<phno>123456</phno>
</emp>
<emp>
<ename>sandeep</ename>
<phno>123456</phno>
</emp>
</branch>
</company>
I tried it with taking XML in XMLList
:
var xl:XMLList = new XMLList(branch.ename)
var xlc:XMLListCollection = new XMLListCollection(xl);
then applied sort to the <ename>
. I am able to get the sorted but XMLListCollection
but the problem is I got the <ename>
collection sorted but I need the sorted <ename>
in the XML.
I tried with deleting the the item in Collection then adding the sorted list but in that case the <name>
is lost.
Please help me out in sorting <ename>
or is there any way to specify nested tags in SortField
name? Thanks in advance.
Check my previous question that is pretty much the same out HERE.
Look for the answer I provided, I was able to sort the XML directly without having to use XML list collection
精彩评论