• XML validator usage

XML validator usage

XML ValidatorBuddy offers some simple to use methods to quickly validate one or multiple XML documents and also W3C Schemas and DTDs. The following XML validation standards are currently supported:
XML validation of the active document
You can validate the currently active document of the Editor window in XML ValidatorBuddy at any time with a click on the "Validate" button on the main toolbar. Alternatively you can also use the F8 hot-key to start validation.
The active XML document will be validated if a W3C schema or DTD reference can be found. In any case the results of the validation are displayed in the "Results" window:
If the results have one or more validation errors, the position of the first entry is selected automatically in the XML document. You can jump to any error position with a click on the related entry in the Results window. XML ValidatorBuddy reports all errors at once. This enables you to quickly fix all validation errors in your XML instance.
XML validation of multiple documents from the File Explorer
At first you need to select the folder containing the XML data to validate. It is possible to type the path directly into the Folder-browse control or use the folder-button which displays a dialog to select the folder. If you type inside of the Folder-browse edit field, a suggestion box appears with a list of matching entries from the folder history. You can also select one of the suggestions to quickly navigate to the folder. The Folder-browse control is located on the top-left corner of the built-in File Explorer tab as you can see on the screen-shot below:
The application reads the folder content and displays a list of files in the Explorer window. At the same time all XML documents are scanned in the background for XML related information like namespaces, W3C schema or DTD references and digital signatures. Those details are shown in the right-hand columns of the list. This way it is not necessary to open each document to know if a schema or DTD is already assigned to the document. The picture below shows a typical folder list in XML ValidatorBuddy.
To validate one or multiple XML instance documents, W3C Schemas or DTDs, it is necessary to select them in the File Explorer view. There are also "Select all" and "Invert selection" commands available to select all entries and to invert the current selection (to select those entries which are currently not selected). The selected XML documents can be validated by simply pressing F8 or by choosing the "Validate" command from the XML menu or from the File Explorer context menu.
All documents with a W3C schema or DTD reference and all schemas and DTDs are now validated. The results of the validation are displayed in a separate dialog if more then one document is validated at once:
Each document which has already been validated gets a valid or invalid icon in the built-in Explorer view. If a file is afterwards modified by any editor or external application the validation status is updated automatically. On hoovering over an invalid validation status icon the reported errors are shown as you can see here:
Run the XML validator on a single folder
The same command to run XML validation for one or multiple documents can be used to validate all XML files of a single folder and its subfolders. Use the Explorer window in XML ValidatorBuddy to select a single folder and start the validation with the "Validate" command from the XML menu. During the validation the status line of the application shows which XML document is currently processed. After all of the XML documents of the folder are validated a dialog appears to show the results.
Please note that in the same way you can run a well-formed check on a single folder. Just use the "Check if XML well-formed" command instead after selecting the folder in the File Explorer window.
XML validation without schemaLocation attributes
Select a schema for validation - W3C, DTD or RelaxNG
If you want to set a specific schema for validation please use the "Validate against a specific Schema..." command from the XML menu or the Explorer context menu. You can also select any RelaxNG schema to validate the XML documents against it.
Use the XML schema catalog
In contrast to many other tools XML ValidatorBuddy supports validation of XML data against W3C schema definitions without an explicit reference in the instance document.
This is done using a standard OASIS 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:
The "Add to Schema catalog for validation" command is part of the File Explorer context menu.
Whenever an XML document 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 possible to validate XML without a schemaLocation attribute.
Schematron validation
The desktop application offers several ways to validate an XML instance document against a Schematron schema.
1.) Open the XML instance on which you want to run the Schematron validation and use the "Schematron" field on the "Quick Associations" window of the application to permanently assign a Schematron schema to this document. Use the "Validate with Schematron" command to apply the rules from this Schematron schema to the active document.
2.) Select one or multiple instance documents in the Explorer window together with a single Schematron .sch schema. XML ValidatorBuddy will recognize the schema on using the "Validate with Schematron" command and validates the selected documents against it.
3.) If the instance document contains a processing instruction pointing to a Schematron schema you can directly use the "Validate with Schematron" command to apply the schema. The name of the processing instruction can be set on the Schematron page of the settings dialog.
4.) It is possible to configure a batch task to use a Schematron schema. Use the "Configure and run a batch task..." command of the XML ValidatorBuddy desktop application to setup the batch. You can find this command in the context menu of the Explorer tab or in the "File Explorer" menu. To define a Schematron batch select "Schematron" at the "Parser to use:" field, check the "Use external schema" option and insert the path to the Schematron schema at the related edit field (see also Configure a batch).