title: XML compression/decompression library for C# / .NET
body: <p>In my application the XML contains all data and it sometimes exceeds up to 5-10 MB. The file is loaded and saved many times during program execution. Although, it is fast but it seems sometimes file gets corrupted when it becomes large in size. I do not know why the file gets corrupted but in all cases the file was 5+ MB, so I am assuming the larger XML file becomes, the more susceptible it is to corruption. So, please suggest a XML file compression/decompression library</p>
  
  <ol>
  <li>preferably popular compressions like zip/lzw/7zip/rar etc.</li>
  <li>which must be fast. for example, it should take no more than 100 ms for compress/decompress a 10 MB file at the fastest compression level and sacrificing space.</li>
  <li>easy to integrate.</li>
  </ol>
  
  <p>I am using code:</p>
  
  <pre><code>XMLDocument.Load(XML_File.xml)
  XMLDocument.Save(XML_File.xml)
  </code></pre>
  
  <p>So I want something like:</p>
  
  <pre><code>XMLDocument.Load(Library.Load(XML_File.zip))
  Library.Save(XMLDocument)
  </code></pre>
  
  <p>I hope this solves my above problem. Any other alternative?</p>
  
  <p>I am thinking of one more solution: if you have used winrar, you will notice that it has option to add recovery record in a .rar file so that if the file gets corrpted then it can be fixed using recovery record. Anything similar that I can use in XML files in C# programatically? like:</p>
  
  <pre><code>try{ 
  XMLDocument.Load(Library.Load(XML_File.zip))
  }
  catch{ 
  XMLDocument.Load(Library.Load(Library.File_Recover(XML_File.zip))) 
  }
  </code></pre>