The best way to Compress XML

c#

Solution

It may not be the "smallest size possible", but you could use use `System.IO.Compression` to compress it. Zipping tends to provide very good compression for text.

using (var fileStream = File.OpenWrite(...))
using (var zipStream = new GZipStream(fileStream, CompressionMode.Compress))
{
    zipStream.Write(...);
}

Problem

I need to compress a very large xml file to the smallest possible size. I work in C#, and I prefer it to be some open source or application that I can access thru my code, but I can handle an algorithm as well. Thank you!

Original source