title: Remove Namespaces During XML Serialization
body: <p>Given this generic serialization code:</p>
  
  <pre><code>public virtual string Serialize(System.Text.Encoding encoding)
  {
   System.IO.StreamReader streamReader = null;
   System.IO.MemoryStream memoryStream = null;
  
   memoryStream = new System.IO.MemoryStream();
   System.Xml.XmlWriterSettings xmlWriterSettings = new System.Xml.XmlWriterSettings();
   xmlWriterSettings.Encoding = encoding;
   System.Xml.XmlWriter xmlWriter = XmlWriter.Create(memoryStream, xmlWriterSettings);
   Serializer.Serialize(xmlWriter, this);
   memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
   streamReader = new System.IO.StreamReader(memoryStream);
   return streamReader.ReadToEnd();
  }
  </code></pre>
  
  <p>and this object (gen'd from xsd2code):</p>
  
  <pre><code>[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")]
  [System.SerializableAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "Com.Foo.Request")]
  [System.Xml.Serialization.XmlRootAttribute(Namespace = "Com.Foo.Request", IsNullable = false)]
  public partial class REQUEST_GROUP
  {
  
   [EditorBrowsable(EditorBrowsableState.Never)]
   private List&lt;REQUESTING_PARTY&gt; rEQUESTING_PARTYField;
  
   [EditorBrowsable(EditorBrowsableState.Never)]
   private RECEIVING_PARTY rECEIVING_PARTYField;
  
   [EditorBrowsable(EditorBrowsableState.Never)]
   private SUBMITTING_PARTY sUBMITTING_PARTYField;
  
   [EditorBrowsable(EditorBrowsableState.Never)]
   private REQUEST rEQUESTField;
  
   [EditorBrowsable(EditorBrowsableState.Never)]
   private string iDField;
  
   public REQUEST_GROUP()
   {
    this.rEQUESTField = new REQUEST();
    this.sUBMITTING_PARTYField = new SUBMITTING_PARTY();
    this.rECEIVING_PARTYField = new RECEIVING_PARTY();
    this.rEQUESTING_PARTYField = new List&lt;REQUESTING_PARTY&gt;();
    this.IDField = "2.1";
   }
  }
  </code></pre>
  
  <p>Output from the Serialize with an encode of utf-8:</p>
  
  <p><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;REQUEST_GROUP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="2.1" xmlns="Com.Foo.Request"&gt;
      &lt;RECEIVING_PARTY /&gt;
      &lt;SUBMITTING_PARTY /&gt;
      &lt;REQUEST LoginAccountIdentifier="xxx" LoginAccountPassword="yyy" _RecordIdentifier="" _JobIdentifier=""&gt;
          &lt;REQUESTDATA&gt;
              &lt;PROPERTY_INFORMATION_REQUEST _SpecialInstructionsDescription="" _ActionType="Submit"&gt;
                  &lt;_DATA_PRODUCT _ShortSubjectReport="Y" /&gt;
                  &lt;_PROPERTY_CRITERIA _City="Sunshine City" _StreetAddress2="" _StreetAddress="123 Main Street" _State="CA" _PostalCode="12345"&gt;
                      &lt;PARSED_STREET_ADDRESS /&gt;
                  &lt;/_PROPERTY_CRITERIA&gt;
                  &lt;_SEARCH_CRITERIA /&gt;
                  &lt;_RESPONSE_CRITERIA /&gt;
              &lt;/PROPERTY_INFORMATION_REQUEST&gt;
          &lt;/REQUESTDATA&gt;
      &lt;/REQUEST&gt;
  &lt;/REQUEST_GROUP&gt;</code></p>
  
  <p><strong>EDIT</strong>
  Question 1: How do I decorate the class in such a fashion, or manipulate the serializer to get rid of all the namespaces in the REQUEST_GROUP node during processing, NOT post-processing with xslt or regex.</p>
  
  <p>Question 2: Bonus point if you could add the doc type too.</p>
  
  <p>Thank you.</p>