×
Menu

XML and JSON batch processing

 
The XML ValidatorBuddy tool set makes it easy to create and run a wide range of XML batch validation tasks. It is often complicated to configure a batch task, for example if all options must be set through the command-line. To avoid this XML ValidatorBuddy provides a user-friendly dialog to create and manage all settings which are required to validate many files at once. Any supported batch task can either be started directly from the desktop application or using the command-line tool, which can also be called as a scheduled task by the operating system.
 
Step 1
 
Configure a batch task
All parameters and options to control the batch process are stored in a single XML settings file. This way you can easily use the same settings over and over again and you can create new batch settings using already existing setting files as templates. This is a huge benefit compared to simple command line parameters which you need to remember and often result in multi line command strings.
There are two ways to create this XML settings file:
 
a) Simply by using the "Batch settings" dialog
The "Batch Settings" dialog makes it is easy to define your batch process. To show this dialog use the "Configure and run batch task..." command in the XML ValidatorBuddy desktop application.
 
 
This dialog allows you to set all available options for the batch task in a convenient way. In addition you can load already defined batch settings and save new setting files for later use. Batch validation supports several parsers and types of validation like MSXML, Xerces, Schematron or RelaxNG. Using the Xerces SAX parser is recommended especially for large XML documents.
The "Test batch" button runs the batch as it is defined but without executing the validation. During the test the log file is created and saved. The log file written during the test run gives an overview which and how many files will be processed during the real batch.
This dialog can also be used to run the batch immediately. Push the "Run batch" button to immediately start the batch task. XML ValidatorBuddy will execute the batch as an own process in the background and you can continue working on other things in the meantime. The log file will grow constantly during the batch run.
 
b) Creating the settings XML manually
Open your XML editor or any other text editor which can save the file in Unicode UTF-8 or UTF-16. Even Notepad can do this. Type the following XML to create the simplest settings file for the batch:
<?xml version="1.0" encoding="UTF-8"?>
<batch_settings>
  <batch_units>
    <log_document path="C:\xml_log.xml"/>
    <options/>
    <batch_unit type="validation" validator="XercesC">
      <folder_settings folder="C:\xml" subfolders="true"/>
      <file_extensions>
        <extension>xml</extension>
      </file_extensions>
    </batch_unit>
  </batch_units>
</batch_settings>
 
This settings XML only specifies the necessary parameters:
 
Don't forget to set the encoding on saving the file if you don't use an XML editor to create the file! For a complete list of options in the settings XML please take a look here.
 
Step 2
 
Start the batch
 
Use the desktop application to run the batch
The "Batch settings" dialog in the desktop application makes it easy to define and run a batch task. After all options are set simply click on the "Run batch" button of the dialog.
Use the "Show message box after finishing" check-box in the dialog to control if XML ValidatorBuddy should wait until the batch task has been completed or not. If this check-box is not set, you can continue to use XML ValidatorBuddy but you won't be notified if the batch task is over.
 
Running the batch from the command-line
Open a command prompt at your XML ValidatorBuddy installation folder and enter the line to start valbuddy.exe with the settings XML:
 
 
Of course the batch can take a while depending on how many files with .xml extension are located at C:\xml in this case. If there is only a small number of files to be validated XML ValidatorBuddy should finished the batch in a few seconds.
If the batch process takes several minutes or hours you can open the log file at any time to check the progress while XML ValidatorBuddy is still running.
 
Step 3
 
Open the log file
The batch task creates a log file in XML format. This file can be opened directly in XML ValidatorBuddy or with any other text or XML editor. The path to the log file and its name are set in the batch settings dialog and also written to the settings XML file of the batch task.