use delete keyword to delete child
On Thu, Apr 4, 2013 at 11:29 AM, Prabhu M <[email protected]> wrote: > Check below code.. this will help u.. > > private function uniqueXML():void > { > var str:String = '<school id="4"><class id="2">'+ > '<node id="1" label="class1" value="ragu"/>'+ > '<node id="1" label="class1" value="malik"/>'+ > '<node id="1" label="class1" value="amit"/>'+ > '<node id="3" label="class2" value="sanjay"/>'+'' + > '</class > </school >'; > var xml:XML = new XML(str); > trace("Before: "+xml) > var xList:XMLList = xml.children().children(); > var len:int = xList.length(); > for(var i:int = 0; i < len; i++) > { > var nXml:XML = xList[i]; > for(var j:int = i+1; j< len; j++) > { > if(nXml.@id == xList[j].@id) > { > nXml.@value += ","+xList[j].@value; > delete xList[j]; > len--; > j--; > } > } > } > trace("After: "+xml); > } > > Thanks & Regards, > M.Prabhu > > On Sunday, 30 December 2012 10:41:56 UTC+5:30, bharathi wrote: >> >> >> Hi Friends, >> >> I need your help.At present I am working with xml and display it in >> advance Data Grid. My raw xml looks like this >> >> <school id="4"> >> <class id="2"> >> <node id="1" label="class1" value="ragu"/> >> <node id="1" label="class1" value="malik"/> >> <node id="1" label="class1" value="amit"/> >> <node id="3" label="class2" value="sanjay"/> >> </class > >> </school > >> >> I want to delete the children(node) with same id(@id) and append it to >> single node like below. >> >> <school id="4"> >> <class id="2"> >> <node id="1" label="class1" value="ragu,malik,amit"/> >> <node id="3" label="class2" value="sanjay"/> >> </class > >> </school > >> >> Friends i tried all methods but i cannot get it correctly.I possible pls >> share code. >> >> Thanks in advance >> -- >> *Thanks & Regards,* >> *Bharathidasan.S.* >> > -- > You received this message because you are subscribed to the Google Groups > "Flex India Community" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/flex_india?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/flex_india?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

