title: xml nodes will not delete despite calling "delete"
body: <p>I'm trying to use the delete keyword to remove nodes from an xml file and it just plain won't work. </p>
  
  <p>Here's a stripped down example of what I'm working with. Every node has a child named "deleteme". If its value is equal to 1 I want to remove it from the xml file. If its anything else I want to leave it be. The delete method is deffinately gettig call but it's having no effect.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
      &lt;stuff&gt;
          &lt;i&gt;
              &lt;deleteme&gt;
              0
              &lt;/deleteme&gt;
          &lt;/i&gt;
          &lt;i&gt;
              &lt;deleteme&gt;
              1
              &lt;/deleteme&gt;
          &lt;/i&gt;
          &lt;i&gt;
              &lt;deleteme&gt;
              0
              &lt;/deleteme&gt;
          &lt;/i&gt;
  
      &lt;/stuff&gt;
  </code></pre>
  
  <p><strong>ActionScript</strong></p>
  
  <pre><code>var xmlList:XMLList=_sourceXML.i;
  
                  for (var j:int=0; j &lt; _xmlList.length(); j++)
                  {
  
                      if (xmlList[j].deleteme== 1)
                      {
                          delete xmlList[j];
  
                      }
  
                  }
  //breakpoint here. xmlList still contains nodes that should have been deleted
                  xmlListColl=new XMLListCollection(xmlList);
                  xmlListColl.refresh()
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>If I trace the xmllist lenght before  and after the delete for loop the length is indeed different. It seems for some reason the xmllist being passed to the xmllistcollection is the one with node not deleted. Makes no sense to me.</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>The following gives the desired result. I would still however like to know why the former method was not working.</p>
  
  <pre><code>for (var j:int=0; j &lt; xmlList.length(); j++)
                  {
                      //trace(xmlList[j].deleteme)
                      if (xmlList[j].deleteme!=1 )
                      {
                          //delete xmlList[j];
                          xmlListColl.addItem(xmlList[j])
  
                      }
  
                  }
  </code></pre>