title: C# Removing attribute XML
body: <p>I am trying to remove some specified attributed from the XML file sample code was below.    string[] szNodeList is the array list so node contains name in string array will be removed ans save again</p>
  
  <p>Any help will be appreciated.</p>
  
  <pre><code>        var doc = new System.Xml.XmlDocument();
          doc.Load("attrs.xml");
          var root = doc.DocumentElement;
          string[] szNodeList = new string[]  { "titleTextColor"
          ,"isLightTheme"
          ,"showText"
                      };
          foreach (System.Xml.XmlElement  child in root )
          {
              foreach (string sz in szNodeList)
              {
                  root.RemoveAttribute(sz);
                  //if (child.Attributes[sz] != null)
                  //{
                  //    child.Attributes.Remove(child.Attributes[sz]);
                  //}
              }
          }
  
          doc.Save("build.xml");
  
      XML CODE
  
    &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;resources&gt;
      &lt;attr name="cropImageStyle" format="reference" /&gt;
      &lt;attr name="drawerArrowStyle" format="reference" /&gt;
      &lt;attr name="height" format="dimension" /&gt;
      &lt;attr name="isLightTheme" format="boolean" /&gt;
      &lt;attr name="title" format="string" /&gt;
      &lt;attr name="navigationMode"&gt;
        &lt;enum name="listMode" value="1" /&gt;
        &lt;enum name="normal" value="0" /&gt;
        &lt;enum name="tabMode" value="2" /&gt;
      &lt;/attr&gt;
  
    &lt;/resources&gt;
  </code></pre>
  
  <p>But saving as original file without changes i thing remove is not working.</p>