Tech Blog

DanSharp XmlViewer

The source code and MSIs for this tool (inc v1.1) have moved to GitHub here:

The source code and MSIs for this tool (inc v1.1) are now available on CodePlex


I’ll release v1.1 this week – only has minor bug fixes (one of them related to problems
with opening files from the recently used file menu).
Also I’m planning to release the source code this weekend.

So here’s a little utility that I’ve been using for myself for a while, but thought
I’d release in case it’s of use to anyone else.

There are three tasks I perform quite regularly when doing XML or BizTalk development:

  1. Building and testing the XPath needed to retrieve a value from a given request/response
  2. Validating a document against a schema
  3. Generating BizUnit tests
    cases (from an Xml instance doc, creating XPath statements to validate for all the
    data in the document)

This tool does all three of these things:

XmlViewer main form

Generating a BizUnit Test Case

Although there are good tools on the market for doing 1. and 2. (e.g. Altova
and Stylus Studio)
most of them require installation and are not free.

And none of them generate BizUnit Test Cases!
I wanted a single EXE which would do the most common tasks for me.

Also note that Visual Studio will give you the XPath for an element/attribute in an
Xsd, but not an Xml document.
And although you can validate a document in Visual Studio, it’s a hassle each time
you want to change the Xml document used (right click schema, choose properties, change Input Instance
, cick OK, right click schema, choose Validate Instance).

Having a scratch pad to play with XPath queries has been very useful, and is the original
reason I wrote this.
But generating BizUnit Test Cases has so far been the most useful… if you use the
REG file provided, you can even right-click an Xml file to generate a BizUnit TestCase
for it.

There is a command line version supplied as well, so if you need to generate a lot
of BizUnit Test Cases, you can do so in a batch file/script.

The utility is written as a single EXE, with no additional files needed (other than
.NET 2.0) and it doesn’t need to be installed.
I have a copy on my USB key and I run it from there.

Caveat: I use this tool every day, so most bugs have (hopefully) been eradicated.
So my apologies if you come across something I haven’t tested yet – please let me
know if you do.

Files available to download:

Note: I will be making the source code for this utility available,
but need to tidy it up a bit first.
Will add it here when it’s ready – probably in a week or so.

MSI Installer (contains all of the below files)

    DanSharp.XmlViewer.Setup.msi (1.8MB)

Executable (Windows version)

    XmlViewer.exe (80kb)

Executable (Command line version) (80kb)

Registry File (.reg) for adding right-click support to Xml files

    GenerateBizUnitTestCase.reg (2kb)


XmlViewer Documentation v1.0.pdf
(860kb PDF)
XmlViewer Documentation v1.0.doc
(600kb Word 97 Doc)

Source Code
   (Coming soon)

If you come across bugs or have any comments, then leave a comment here, or email
me at:

Back to Tech Blog