By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,007 Members | 1,025 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,007 IT Pros & Developers. It's quick & easy.

XmlTextWriter and GZipStream

P: 1
Hi All,

I have been looking at the best way of doing this but can't find a solution that doesn't involve using bytes array.

Basically I want to wrap a XmlTextWriter in a GZipStream so I produce a GZipped Xml file.

I have been trying this:

Expand|Select|Wrap|Line Numbers
  1. using (GZipStream gzipout = new GZipStream(File.Create(Path), CompressionMode.Compress))
  2.   {
  3.     XmlTextWriter xtw = new XmlTextWriter(gzipout, Encoding.UTF8);
  4.     ... [write elements and attributes, etc]
  5.   }
But I end up with a gzipped file of 4096 bytes and when I look into it my XML content is truncated. The thing is that my content length is really variable.

Please give your thoughts,

Jul 26 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.