Validation Tutorial
Validation Tutorial
 
 

By Richard Mah and Nitin Dahyabhai
Created on December 22, 2004
Last updated on March 24, 2008

The Web Tools Platform includes validation tools for XML, DTD, and XML Schema files. This tutorial demonstrates how validation can be invoked manually or automatically during builds.

Manually Invoking the Validator
 

Validation can be invoked manually on a resource or group of resources (including but not limited to XML, DTD, and XML Schema files) by invoking the "Validate" context menu item. See Figure 1.

Figure 1

 



Manually invoking validation will run validation in the background. See Figure 2.

Figure 2

 



When validation completes, you will be presented with a validation results dialog, and any problems found will be shown in the Problems view. To open the Problems view, select Problems from the menu bar (Window --> Show View --> Problems). See Figures 3 and 4.

Figure 3


Figure 4

 
 
Automatically Invoking the Validator during Builds
 

To run validation as part of building, the Validation Builder must be set on the project and the desired validators enabled. To ensure that the builder is set onto the project, open the Properties dialog for the project and go to the Validation property page. If the Add Validation Builder to project checkbox is present, enable it. Then, enable the Build checkbox for the desired validators, overriding the main validation preferences if necessary. See Figure 5.

Figure 5


Validation will now be performed on files as they are built, updating the Problems view automatically.

 
 
Locating Errors in the Resource
 

Further information explaining the cause of the validation error will appear in the Problems view. Selecting the error in the Problems view and either double-clicking on it or choosing Go To from its context menu will highlight the error in the Source view allowing users to quickly locate and correct the problem. See Figure 7.

 
 
Figure 6
Figure 7