Loren Halvorson's Blog

If your only tool is a hammer...

New Release of XmlPreprocess

I finally got around to updating the XmlPreprocess tool with some changes I'm really excited about. For those of you not familiar with XmlPreprocess, it's a command line tool I wrote many years ago that can modify specially annotated XML files much like a code preprocessor. It is useful for deploying XML configuration files to many environments. I've blogged about it in the past as have others, and it's achieved a fair amount of use (albeit hidden below the surface) in my good friend Scott Colestock's Biztalk deployment framework.

The first thing I did was move it to a CodePlex project which replaces the prior SourceForge project.

Changes in this release

  • New Codeplex home with updated documentation and samples.
  • Requires .NET 2.0 or newer runtime.
  • Adds the ability to import spreadsheets directly thanks to Tom Abraham's excellent work on the Environment Settings Manager project. This is a really nice feature, and I thank Tom for giving me permission to use his spreadsheet reading code.
  • Adds a command line switch (/f or /fixfalse) to fix the behavior of "False" values. This has been a long-standing request and tripped up many people for example here and here.  For the anguish and consternation this has caused to you all, I sincerely apologize, and hope you forgive me. If you want to explicitly undefine a property, use the value "#undef" instead.  (Note: that for backward compatibility, this behavior is off by default, and you will need to add the /f or /fixfalse switch to enable it).
  • Adds a new command line switch (/v) to validate tokens, so if any replacement tokens are missing, it will report an error message identifying the missing tokens, return a nonzero error code and not write out the file.

I left the current release as Beta 1 in case anyone finds any issues right away, but we've been using the new version on a project without any issues yet.  It should be a drop-in backward compatible replacement for the old version (except for the new dependency on .NET 2.0 instead of 1.1).

Comments

Jeremy Lew said:

Interesting! I have been working on a very similar tool myslef, which has made it into CruiseControl.NET.  My approach is a little different, in that the preprocessor directives are themselves XML in a reserved namespace, rather than markup.  You can read about it here if you're interested:

confluence.public.thoughtworks.org/.../Configuration+Preprocessor

I have since added many more features, including the equivalent of #if/#ifdef/#else blocks, and looping constructs.  We should compare notes.

jlew@liquidmachines.com

# December 11, 2008 5:43 PM

XMLPreprocess Getting Started « Here's – nnish! Nishanth Anil said:

Pingback from  XMLPreprocess Getting Started « Here's – nnish! Nishanth Anil

# July 19, 2009 5:36 AM

black hattitude said:

Hi,

thanks for the great quality of your forum, each  time i come here, i'm amazed.

i read your posts regularly and i finaly decided to subscribe.

<a href=http://blackhattitude.blackhattitude.org>black hattitude</a>.

# October 9, 2009 4:08 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)