title: Remove empty xmlns="" after Xml Serialization
body: <p>So I am still asking questions about this topic :-(</p>
  
  <p>So I create an object, decorate it with the Xml Serialization Attributes, from what I have seen I add an empty namespace to the xml serialization namepsace collections so as not to get the superfluous attributes I did not intend to have.</p>
  
  <p><strong>Edit:</strong> The attribute I mean are these:</p>
  
  <pre><code>&lt;url xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns=""&gt;
  </code></pre>
  
  <p>so it gives me two extra attributes. </p>
  
  <p>After further investigation if I change the beginning of the document from:**</p>
  
  <pre><code>writer.WriteStartElement("urlset","http://www.sitemaps.org/schemas/sitemap/0.9");
  </code></pre>
  
  <p>to</p>
  
  <pre><code>writer.WriteStartElement("urlset");
  </code></pre>
  
  <p>**Then I do not get the empty xmlns="" attribute in the url tags.  This is great BUT I do require that the root element have <code>xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"</code>, i.e.:</p>
  
  <pre><code>&lt;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt;
  </code></pre>
  
  <p>But I still get an empty <code>xmlns=""</code> attribute in the serialized type.</p>
  
  <pre><code>[XmlRoot(ElementName = "url", Namespace="")]
  public class SitemapNode
  {
      [XmlElement(ElementName = "loc")]
      public string Location { get; set; }
      [XmlElement(ElementName = "lastmod")]
      public DateTime LastModified { get; set; }
      [XmlElement(ElementName = "changefreq")]
      public SitemapChangeFrequency ChangeFrequency { get; set; }
      [XmlElement(ElementName = "priority")]
      public decimal Priority { get; set; }
  
      public SitemapNode()
      {
          Location = String.Empty;
          LastModified = DateTime.Now;
          ChangeFrequency = SitemapChangeFrequency.monthly;
          Priority = 0.5M;
      }
  
      public SitemapNode(string location, DateTime lastModified, SitemapChangeFrequency changeFrequency, decimal priority)
      {
          Location = location;
          LastModified = lastModified;
          ChangeFrequency = changeFrequency;
          Priority = priority;
      }
  }
  </code></pre>
  
  <p>Then I use the following to append to my XmlWriter:</p>
  
  <pre><code>foreach (uk.co.andrewrea.SitemapNode node in List)
  {
      XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
      ns.Add(String.Empty, String.Empty);
      Serializer.Serialize(Writer, node, ns);
  }
  </code></pre>
  
  <p>This works out fine except I am left with an emtpy xmlns="" like this</p>
  
  <pre><code>&lt;url xmlns=""&gt;
  </code></pre>
  
  <p>Anyone any ideas?  Again I can achieve this using the XmlTextWriter and the XmlDocument but I need to achieve it using the XmlWriter.</p>
  
  <p>Any help is greatly appreciated.</p>