title: XNamespace in C#
body: <p>i am building an XML using XDocument.this is my code</p>
  
  <pre><code>        var ns = XNamespace.Get("url");        
      XDocument requestXMl = new XDocument(
          new XElement(ns+"WEB_REQUEST",
              new XElement("HTTP_HEADER_INFORMATION",
                  new XElement("DEFINED_HEADERS",
                      new XElement("HTTP_DEFINED_REQUEST_HEADER",
                              new XElement("ItemNameType", "RequestDate"),
                              new XElement("ItemValue", _currentTime)
                                  ),
                          new XElement("HTTP_DEFINED_REQUEST_HEADER",
                              new XElement("ItemNameType", "AuthorizationValue"),
                              new XElement("ItemValue", credentials)
                                  )
                                )
                             ),
              new XElement("COLL",
                  new XElement("TID", _t),
                  new XElement("SID", _s)
                          )
                      )
              );
  </code></pre>
  
  <p>the output for this code is </p>
  
  <pre><code>  &lt;WEB_REQUEST xmlns="url"&gt;
    &lt;HTTP_HEADER_INFORMATION xmlns=""&gt;
      &lt;DEFINED_HEADERS&gt;
        &lt;HTTP_DEFINED_REQUEST_HEADER&gt;
          &lt;ItemNameType&gt;RequestDate&lt;/ItemNameType&gt;
          &lt;ItemValue&gt;Wed,06 May 2015 18:14:33 GMT&lt;/ItemValue&gt;
        &lt;/HTTP_DEFINED_REQUEST_HEADER&gt;
        &lt;HTTP_DEFINED_REQUEST_HEADER&gt;
          &lt;ItemNameType&gt;AuthorizationValue&lt;/ItemNameType&gt;
          &lt;ItemValue&gt;ieuKB5voR3w==&lt;/ItemValue&gt;
        &lt;/HTTP_DEFINED_REQUEST_HEADER&gt;
      &lt;/DEFINED_HEADERS&gt;
    &lt;/HTTP_HEADER_INFORMATION&gt;
    &lt;COLL xmlns=""&gt;
      &lt;TID&gt;&lt;/TID&gt;
      &lt;SID&gt;&lt;/SID&gt;
    &lt;/COLL&gt;
  &lt;/WEB_REQUEST&gt;
  </code></pre>
  
  <p>I don't want the xmlns to appear 3 times as it appears in the output. 
   I want it to appear only 2 times.</p>
  
  <pre><code>&lt;WEB_REQUEST xmlns="url"&gt; 
    &lt;COLLABORATION xmlns=""&gt;
  </code></pre>
  
  <p>how can i achieve this ? </p>