Yow-Hann Lee - Software Happens

All things Computer Science, .NET & WWW

  Home  |   Contact  |   Syndication    |   Login
  132 Posts | 7 Stories | 38 Comments | 50 Trackbacks

News


Article Categories

Archives

Post Categories

About

I blogged about this last week here.  I was talking about two separate things: File format and human readable layouts.  Today, I will add to the latter topic.  In particular, uncompressed (with indentations/whitespaces) xml files vs. compressed files.  For JavaScript files, you would generally compress your files for the production/deployed version and keep an uncompressed debug version in your source repository.  This also applies for css files with the rationale that you are attempting to reduce download size and improving performance.  However, unless you have xml being downloaded to the client, it would seem like an unecessary step.  If the xml files will always be kept on the server as resources, in the general case, you would want to leave it in a pretty printed fashion.

It really is as simple as specifying two lines in your code:

xmlReader.WhitespaceHandling = WhitespaceHandling.None;
xmlWriter.Formatting = Formatting.Indented;

While on the topic of xml, if you want to do a comparison two xml files, this tool may be the way to go: http://msdn2.microsoft.com/en-us/library/aa302295.aspx.  It uses Microsoft.XmlDiffPatch.

posted on Friday, October 27, 2006 5:33 PM