Not yet rated

Problem

Has no XML method to remove children

Solution

Need to create dummy XML, set as children and then remove it.

Detailed explanation

So the next example. We have an XML object named ourWorkXML:

<data>
    <nodes>
          <item/>
          <item/>
          <item/>
    </nodes>
</data>

And we want to remove all item. Then what we write:

var nodes:XML=ourWorkXML.nodes;
nodes.setChildren(<dummy/>)
delete nodes.dummy;

We just replace all children witn one child but we know its name. And we no need to remove every children with cycle.

 


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes