title: How to add xsi:noNamespaceSchemaLocation to Serializer
body: <p>I build an XML Document which needs to be validated against a xsd file. Thus I need a reference to the xsd file in the root element of the xml. So far I use this C# Code:</p>
  
  <pre><code>var ser = new XmlSerializer(typeof(myspecialtype));
  XmlSerializerNamespaces MainNamespace = new XmlSerializerNamespaces();
  MainNamespace.Add("xlink", "http://www.w3.org/1999/xlink");
  MainNamespace.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
  using (XmlWriter w = XmlWriter.Create(@"C:\myxmlfile.xml"))
  {
      w.WriteProcessingInstruction("xml-stylesheet", "type=\"text/xsl\" href=\"utils/somexsl.xsl\"");
      ser.Serialize(w, LeBigObject, HauptNs);
  }
  </code></pre>
  
  <p>The resulting Xml begins like this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="utils/somexsl.xsl"?&gt;
  &lt;caddy-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlVersion="03.07.00"&gt;
  </code></pre>
  
  <p>but I need this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="utils/somexsl.xsl"?&gt;
  &lt;caddy-xml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlVersion="03.07.00" xsi:noNamespaceSchemaLocation="utils/theveryimportant.xsd"&gt;
  </code></pre>
  
  <p>I came across "CreateAttribute" here: <a href="https://stackoverflow.com/questions/36146718/">Add Namespace to an xml root node c#</a> but I can't put it together with the Serializer. Thank you!</p>