title: How to remove some particular tag from XML
body: <p>I have one XML like below, and I want to remove <code>Players</code> tag when <code>Flg = 1</code></p>
  
  <pre><code>&lt;sports&gt;
      &lt;cricket Team = England&gt;
          &lt;Players Name = "EAA" Flg = "0"&gt;&lt;/Players&gt;
          &lt;Players Name = "EAB" Flg = "1"&gt;&lt;/Players&gt;
      &lt;/cricket&gt;
      &lt;cricket Team = India&gt;
          &lt;Players Name = "IAA" Flg = "0"&gt;&lt;/Players&gt;
          &lt;Players Name = "IAB" Flg = "1"&gt;&lt;/Players&gt;
      &lt;/cricket&gt;
      &lt;cricket Team = Aus&gt;
          &lt;Players Name = "AAA" Flg = "0"&gt;&lt;/Players&gt;
          &lt;Players Name = "AAB" Flg = "1"&gt;&lt;/Players&gt;
      &lt;/cricket&gt;
  &lt;/sports&gt;
  </code></pre>
  
  <p>So what I tried here is </p>
  
  <pre><code>var Players = xml.getElementsByTagName('Players');
  var arr = Array.prototype.slice.call( Players  )
  for(var i=0; i&lt;arr.length; i++)
  {
      var FlgAtt = arr[i].getAttribute('Flg');
      if(Flg == "1" ){
          arr.splice(i,1)
      }
  }
  </code></pre>
  
  <p>But in the final XML those player tags are still available. My final output should be like </p>
  
  <pre><code>&lt;sports&gt;
      &lt;cricket Team = England&gt;
          &lt;Players Name = "EAA" Flg = "0"&gt;&lt;/Players&gt;
      &lt;/cricket&gt;
      &lt;cricket Team = India&gt;
          &lt;Players Name = "IAA" Flg = "0"&gt;&lt;/Players&gt;
      &lt;/cricket&gt;
      &lt;cricket Team = Aus&gt;
          &lt;Players Name = "AAA" Flg = "0"&gt;&lt;/Players&gt;
      &lt;/cricket&gt;
  &lt;/sports&gt;
  </code></pre>
  
  <p>Can anybody tell me what I am doing wrong and how to solve these issues?</p>