XML ValidatorBuddy offers a lot of functionality for XML files. You can check your XML documents for well-formedness, you can validate against W3C schema files, against DTDs and also against Schematron rules. It is also possible to validate huge XML files without loading them into memory which is a big benefit and to validate multiple XML files at once and also to run batch validations. XML ValidatorBuddy also does XSL transformations and can generate documentations for W3C schema files. This is a lot of functionality but how do you edit your XML? For this purpos the XML ValidatorBuddy application offers a nice way to quickly launch your favorite editor for any file.

There are good and affordable text editors available which also support editing of XML with things like syntax-coloring and pretty-printing. Currently I prefer to use Notepad++ to edit my XML files which is free and already a mature software. To use it just download and install it from here: http://sourceforge.net/projects/notepad-plus/files/
And here is how to link your favorite text and XML editor to the XML ValidatorBuddy desktop application. We will use the user tool functionality of the application. At first you need to start XML ValidatorBuddy from the Windows Start menu. Then open the Options dialog to add a custom user tool. This is possible on the “Tools setup” page of the Options dialog. Use the “New” button at the right top corner to add a new tool and fill the controls like you can see it on this screenshot:

Tools setup page
This will add Notepad++ as an icon to the File Explorer tab of the application and also a command to the context menu. From now on you can open any of the selected files quickly in Notepad++ by just clicking the icon or using the command. The screenshot below shows how XML ValidatorBuddy integrates the external tool as an icon on a row at the bottom of the File Explorer window:

Notepad++ icon
If you open the file in the external editor and save it modified the validation status is automatically updated in XML ValidatorBuddy (if the file has been validated already).
Of course you can add any external tool to XML ValidatorBuddy which supports command-line options and also execution of Java code something I will show in the next blog entry…
Application, external tools, ValidatorBuddy, XSL
Running any XSL transformation as easy as getting the file properties in the Windows File Explorer? A user friendly way to run XSL transformations allows a wider range of people to work with XML files. Therefore the next version of XML ValidatorBuddy will provide a command to do XSL transformations. So XML ValidatorBuddy makes it possible for everyone to run XSL transformations for any XML file using any XSL stylesheet by a simple dialog:

XSL transformation dialog
All you need to do is to install XML ValidatorBuddy (available with version 2.7) and the free AltovaXML parser.
ValidatorBuddy, XML, XSL
Today I read by chance a post in the oXygen XML editor forum (here) if it is possible to get the XSL which is used in the last step of Schematron validation to validate the XML instance. To make it short: in oXygen there is no special functionality for it, with ValidatorBuddy in XMLSpy you get it with one click.
Some background: Usually, to validate a XML instance document using Schematron a XSL stylesheet which is generated from the Schematron schema is applied to the input XML. To generate the XSL to validate the XML another XSL stylesheet that implements the Schematron definition is used. In addition you also need to do some pre-processing to resolve the includes at least. Guess what, this is also done with the help of a stylesheet.
To simplify this for the user and to save time XML ValidatorBuddy has a button to get the final XSL used to validate the XML with one click:

Get XSLT button for Schematron
On the upper-right corner you can see the “Get XSLT” button. If a Schematron stylesheet is assigned to the XML a new .xsl document will be created in XMLSpy with the stylesheet to validate any instance document.
You can then save this stylesheet and apply it to any XML with simple XSL transformation or you can use it to debug the Schematron schema in the built-in debugger of XMLSpy.
Schematron, ValidatorBuddy, xmlspy, XSL
Internet Explorer is really strange. Yesterday I noticed that the empty cells in the “General” column of the generated HTML from the validation log coming from XML ValidatorBuddy were not shown. I mean no borders are around them but the <td> elements are present.
So I took a look at the CSS styles of the HTML and set the empty-cells style to “show”. No difference. IE still didn’t show the empty cells. I thought to myself: “There is a style named “empty-cells” and you can set it to “show” but even then empty cells are not shown, well …”
As usual the next step is to search the Internet. Looking for “empty-cells show” gives a lot of hits complaining that this is not working in IE. Ok, at least I’m not alone with the problem. Luckily there are also some hints how to solve it. I choose the “border-collapse: collapse” approach. How stupid I am that I didn’t know right from the start that collapsing the borders is the way to show empty cells. I mean there is nothing more obvious…
Anyways, the output of the sample XSL transformation of the ValidatorBuddy batch validation log looks much better now:

Validation report HTML with borders
Batch validation, HTML, InternetExplorer, ValidatorBuddy, XSL
Having the results of the XML batch validation as a log document in XML format is nice but giving the option to automatically run a XSL transformation on the log is even nicer. Therefore I added to the upcoming release 2.5 of XML ValidatorBuddy a task which runs any stylesheet after the batch has finished to produce any other possible text output from the log file.
The batch dialog of ValidatorBuddy got the new “Transform output file” option in the Output file settings group:

Output file settings
On clicking the “Configure…” button a dialog appears where you can select the XSL stylesheet and the name of the output file to generate:

Configure output transformation
In this case ValidatorBuddy will execute the batch and take the valbuddy_log.xslt afterwards to transform the output log to the AltovaExamples.html file. Please note that you need to have the free AltovaXML parser installed in order to successfully run this transformation.
Of course you can specify any XSL here to create the output you need but the installer of ValidatorBuddy will put the sample valbuddy_log.xslt I created into the installation folder. This way you can get HTML from your log without any extra effort on your side.
To create the XSL I used the quite impressive Altova Stylevision tool. I have to admit that I’m not really an expert in writing XSL stylesheets and it would take me hours just to have this rather simple XSL working. But there is no need to be an expert in XSL when you use Stylevision. Just design the layout and select the output type you want to create from your input XML. In my case I just did a few drag-and-drop operations, added two XPath based conditions to have a green background if a file is valid and a red if the file is invalid. Then I told Stylevision to produce the XSL for me an save it. Voilà! It took me about 20 minutes and that without being a stylesheets guru.

Validation log transformed to HTML
All of this is available in XML ValidatorBuddy 2.5 coming soon…
batch, HTML, ValidatorBuddy, XSL