title: C# XML - Multiple Namespace Declaration with XML Writer
body: <p>I am trying to create an XML document with multiple namespaces using System.Xml.Xmlwriter in C# and am recieving the following error on compile:</p>
  
  <blockquote>
    <p>The prefix '' cannot be redefined from '' to 'http://www.acme.com/BOF' within the same start element tag.</p>
  </blockquote>
  
  <p>The entirety of my code is below:</p>
  
  <pre><code>        XmlWriterSettings settings = new XmlWriterSettings { Encoding = Encoding.UTF8, Indent = true };
  
          XmlWriter writer = XmlWriter.Create("C:\\ACME\\xml.xml", settings);
  
          writer.WriteStartDocument();
  
          writer.WriteStartElement("BOF");
          writer.WriteAttributeString("xmlns", null, null, "http://www.acme.com/BOF");  //This is where I get my error
          writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
          writer.WriteAttributeString("fileName", null, null, "test.xml");
          writer.WriteAttributeString("date", null, null, "2011-10-25");
          writer.WriteAttributeString("origin", null, null, "MYORIGIN");
          writer.WriteAttributeString("ref", null, null, "XX_88888");
          writer.WriteEndElement();
  
          writer.WriteStartElement("CustomerNo");
          writer.WriteString("12345");
          writer.WriteEndElement();
  
          writer.WriteEndDocument();
  
          writer.Flush();
          writer.Close();
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks</p>
  
  <p>John</p>