title: XmlWriter won't generate the namespaces I need correctly
body: <p>I am trying to generate XML data that matches this format:</p>
  
  <pre><code>&lt;samlp:AuthnRequest
          xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
          xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
          IssueInstant="2018-07-04T19:19:53.284Z"
          ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
          Version="2.0"&gt;
      &lt;samlp:NameIDPolicy
              AllowCreate="true"
              Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"/&gt;
  &lt;/samlp:AuthnRequest&gt;
  </code></pre>
  
  <p>It's obviously missing a lot of tags for anonymity reasons.</p>
  
  <p>I am using <code>XmlWriter</code>.</p>
  
  <p>I managed to generate this data with different sets of WriteStartElement() and WriteAttributeString(), but I can never get it right. Either the result is slightly different, or it just crashes halfway with XmlException like</p>
  
  <pre><code>System.Xml.XmlException: 'The prefix '' cannot be redefined from 'samlp' to
  'urn:oasis:names:tc:SAML:2.0:assertion' within the same start element tag.'
  </code></pre>
  
  <p>Here are a couple of my attempts and results.</p>
  
  <p>Attempt #1</p>
  
  <pre><code>using (XmlWriter xw = XmlWriter.Create(sw, xws))
  {
      xw.WriteStartElement("AuthnRequest", "samlp");
      xw.WriteAttributeString("xmlns", "samlp", null, "urn:oasis:names:tc:SAML:2.0:protocol");
      xw.WriteAttributeString("xmlns", "urn:oasis:names:tc:SAML:2.0:assertion");
      // ...
  }
  </code></pre>
  
  <p>Result #1</p>
  
  <pre class="lang-none prettyprint-override"><code>Crashed with the above message.
  </code></pre>
  
  <p>Attempt #2</p>
  
  <pre><code>using (XmlWriter xw = XmlWriter.Create(sw, xws))
  {
      xw.WriteStartElement("AuthnRequest", "samlp");
      xw.WriteAttributeString("xmlns", "samlp", null, "urn:oasis:names:tc:SAML:2.0:protocol");
      // ...
  }
  </code></pre>
  
  <p>Result #2</p>
  
  <pre><code>&lt;AuthnRequest
      xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
      ForceAuthn="false" ID="ID_4f85b6d1-a839-4899-972c-12275bf8711c"
      IssueInstant="2018-08-15T18:23:49Z"
      ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
      Version="2.0"
      xmlns="samlp"&gt;
      ...
  </code></pre>
  
  <p>The rest of the attempts are all slight variations of those two, moving around parameters but none are as close as them to my desired result.</p>
  
  <p>Specifically, I have a lot of trouble with generating this attribute:</p>
  
  <pre><code>xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
  </code></pre>
  
  <p>Either it doesn't show up or is wrong.</p>
  
  <p>I can't figure out what I'm missing in order to generate it the way I need.</p>