Enhanced schema and DTD validation

Beside Schematron validation the XML ValidatorBuddy plugin also includes the popular Xerces parser to do W3C and DTD validation within XMLSpy. But what are the benefits of also having simple access to the Xerces engine in the XML editor? Most of the time people are asking for two things:

  • A second parser to compare validation results and to increase the standard conformance of any self-developed schema.
  • How to get all validation errors at once? In this case XML ValidatorBuddy helps to avoid validating the XML document over and over again. The screenshot above shows a good example where just two minor typos need to be corrected but both of them are reported at once.

 

»crosslinked«

Share
, ,

In contrast to many other tools XML ValidatorBuddy supports validation of XML files against W3C schema definitions without an explicit reference in the instance document.

This is done using an XML catalog and an association based on the usage of namespaces in the instance document and the definition of a target namespace in the schema. XML ValidatorBuddy provides a simple command for adding any W3C schema with a target namespace to the internal XML catalog:

add to xml catalog command

Add to XML catalog command

The “Add to Schema catalog for validation” command is part of the File Explorer context menu. Just select a W3C schema file and select the menu item after a right-mouse-click.

Whenever an XML file is validated, any grammar which is available in the XML catalog is also used for validation if a matching namespace usage is found. This way it is no longer necessary to provide a schemaLocation attribute in every XML instance.

Share
, , , , ,

The release of XML ValidatorBuddy 3.4 comes closer and I want to take this opportunity to give an outlook on the major new features of the next version.

  • W3C schema validation using namespace mappings with XML catalog support
    Release 3.4 of XML ValidatorBuddy will be able to validate instance documents without any schemaLocation attributes. Instead the namespace information from the XML can be used to load a W3C schema with the same target namespace if this schema is known in the XML catalog. Any schema with a target namespace can be added to the catalog with a single command.
  • Integration of Saxon as XSL transformation engine.
    The popular and powerful Saxon XSL engine can be used in XML ValidatorBuddy 3.4 to improve performance and to enable Saxon specific transformations.
  • Improved Schematron validation
    Using the Saxon XSL engine makes Schematron validation faster in the desktop application and the Altova XMLSpy® plugin. In addition the Schematron implementation will support the use of abstract patterns as a new validation feature.

As usual, everyone with a valid 3.x license of XML ValidatorBuddy can upgrade to 3.4 free of charge.

Share
, , ,

Currently the XML ValidatorBuddy software (desktop application and XMLSpy plugin) installs the standard XSLT 1.0 stylesheets for Schematron validation. However, since the parser is also capable of XSLT 2.0 it is also possible to use the ISO Schematron XSLT2 implementations. Those are available as a ZIP archive from www.schematron.com

Simply download the archive and extract the files to any folder you like. Then open the settings dialog to enter the paths to the new stylesheets. In the desktop application use the “Options” command, in case of the XMLSpy plugin click the “Settings…” button on the Advanced tab. As you can see in the screenshot below, browse for the iso_dsdl_include.xsl and iso_schematron_skeleton_for_saxon.xsl stylesheets:

Schematron settings

Schematron settings

This way you can use the improved Schematron XSLT2 implementations of the ISO standard.

Share
, ,

Starting with version 3.3 of XML ValidatorBuddy you can also validate XML instance files using a RelaxNG schema.

Because the RelaxNG standard doesn’t define a way how to put a reference to the schema into the XML instance file, you have to use the “Validate against Schema” functionality within the desktop application of XML ValidatorBuddy. Simply select a RelaxNG schema file, typically having a *.rng file extension, and click “Validate” to check the XML document.

Of course you can also validate multiple documents at once by selecting more files in the File Explorer window. RelaxNG validation is also available for the batch validation component. Just select RelaxNG as parser when you configure the batch task.

 

Share
, ,

Detailed error report on validation

Until today the free XML ValidatorBuddy shell tool, which uses the Xerces parser internally, only reported if the XML instance is valid or not. This has changed with the latest release 3.2.2 of the XML command line tool. Now it is also possible to get a detailed error report with the new -verbose option on validating one or more documents.

Just add the -verbose option to the command line to turn it on:

valbuddy.exe -v -verbose ctI031.xml
XML ValidatorBuddy command-line Tool
By xml-tools.com, Copyright 2012

C:\Users\Documents\xml\xmlschema2006-11-06\msData\complexType\ctI031.xml: invalid
Line: 3, Col: 29 : complex type ',fooType' does not permit substitution
Line: 6, Col: 12 : no declaration found for element 'fooEle3'
Line: 7, Col: 12 : element 'fooEle3' is not allowed for content model '(fooEle1,fooEle2)'

New external schema option

Not all XML instances have a schema already assigned. To successfully validate those documents one needs to specify an external schema. To accomplish this the latest release of the XML ValidatorBuddy command line tool also provides a new -s option. If the -s option has been added to the command line, the first specified path is taken as the schema file to validate all following XML instances.

valbuddy.exe -v -verbose -s ctI030.xsd ctI031.xml
XML ValidatorBuddy command-line Tool
By xml-tools.com, Copyright 2012

C:\Users\Documents\xml\xmlschema2006-11-06\msData\complexType\ctI031.xml: invalid
Line: 3, Col: 29 : complex type ',fooType' does not permit substitution

All sample files are taken from the official W3C Schema test suite and can be downloaded here: http://www.w3.org/XML/2004/xml-schema-test-suite/#releases

 

Share
, , ,

One of the new features in XML validatorBuddy 3.2 is the handy Folder Suggestion Box. Previous versions of XML ValidatorBuddy didn’t have any support for a folder history on the File Explorer window. Basically the new suggestion box searches in its list of folders and presents the matching entries to the user. But the new suggestion box does not only remember the last visited folders, it also knows all directories of the currently displayed folder.

Just type in the name of a directoty or even just parts of any name you remember and the suggestion box will update itself with matching folders. All found entries are on top of the list in the box and the matching string is drawn in green.

Typing in a search string

Typing in a search string

You can then use the mouse pointer or the cursor keys to select one of the entries in the suggestion box. Hit enter or click the line to open the folder. Press ESC to close the suggestion box.

Here you can see the Folder Suggestion Box once again in action together with the rest of the File Explorer window:

Folder suggestion box and File Explorer window

Folder suggestion box and File Explorer window

Share
, , ,

Beyond Compare is a popular and powerful differencing tool available for Windows and Linux. To complement the last blog entry about adding TortoiseMerge as an external tool here is how to add Beyond Compare to ValidatorBuddy to quickly show the differences between two XML files.

Just open the external tools page on the Options dialog and create a new entry for Beyond Compare as usual:

How to add Beyond Compare as external tool

How to add Beyond Compare as external tool

Similar to TortoiseMerge we just need to select the executable file from the “Program files” folder and specify the AllSelectedPaths variable to pass as parameter to Beyond Compare. After closing the Options dialog Beyond Compare appears as button on the bottom of the File Explorer window in ValidatorBuddy:

Beyond Compare button in File Explorer

Beyond Compare button in File Explorer

Please not that if you select more than two files Beyond Compare opens a merge session with the first three files as input and takes the fourth path as output file. Selecting two files opens a standard compare session.

Share
,

As XML ValidatorBuddy supports external tools it is not difficult to add a differencing tool to quickly show the differences between files selected in the FileExplorer of ValidatorBuddy.

There are some very good text-based differencing tools available which are also free. As a first example I take TortoiseMerge which comes installed with TortoiseSVN and can also be downloaded separately from sourceforge as part of the TortoiseDiff package.

If you already have TortoiseMerge installed on your PC you can simply open XML ValidatorBuddy and use the External Tools page of the Options dialog to add the differencing tool. The screenshot shows a sample entry for TortoiseMerge:

TortoiseMerge as external tool

TortoiseMerge as external tool

Here TortoiseMerge is part of the TortoiseSVN installation in the programs folder.

After you have added the differencing tool to XML ValidatorBuddy you can simply select two files from the FileExplorer window and use the “TortoiseMerge” button on the bottom to show the differences.

Share
, ,

The new XML ValidatorBuddy XMLSpy PlugIn is available for download on xml-tools.com since this week.

Now, in contrast to prior versions, the plugin has its focus on Schematron validation and enhanced schema validation of XML files using Xerces to show all validation errors at once. Those are the functionalities the majority of users always used and needed.

As a second benefit, the plugin can be purchased as a single product. Learn more here.

Share
, , ,