blob: dcf61ae73fbff953eb61e84f6c6898c6a5d6c68e [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../../../wtp.xsl"?>
<html>
<head>
<meta name="root" content="../../../../" />
<title>Validation Tutorial</title>
</head>
<body>
<style>
</style>
<h1>Validation Tutorial</h1>
<p>
<b>By Richard Mah and Nitin Dahyabhai</b><br/>
Created on December 22, 2004<BR/>
Last update on March 24, 2008<BR/>
<br/>
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.
</p>
<h2><b>Manually Invoking the Validator</b></h2>
<p>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.
<br/>
<br/>
<table>
<tr>
<td><img border="0" src="images/invoking.png"/></td>
</tr>
<tr>
<td align="right"><em>Figure 1</em></td>
</tr>
</table>
</p>
<p>
<br/>
<br/>
Manually invoking validation will run validation in the background. See Figure 2.
<br/>
<br/>
<table>
<tr>
<td><img border="0" src="images/running.png"/></td>
</tr>
<tr>
<td align="right"><em>Figure 2</em></td>
</tr>
</table>
</p>
<p>
<br/>
<br/>
When validation completes, you will be presented with a validation results dialog, and any problems found will be shown in the <b>Problems</b>
view. To open the <b>Problems</b> view, select <b>Problems</b> from the menu bar (Window --&gt; Show View --&gt; Problems). See Figures 3 and 4.
<br/>
<br/>
<table>
<tr>
<td><img border="0" src="images/results.png"/></td>
</tr>
<tr>
<td align="right"><em>Figure 3</em></td>
</tr>
</table>
<br/>
<br/>
<table>
<tr>
<td><img border="0" src="images/problems.png"/></td>
</tr>
<tr>
<td align="right"><em>Figure 4</em></td>
</tr>
</table>
</p>
<br/>
<br/>
<h2><b>Automatically Invoking the Validator during Builds</b></h2>
<p>
To run validation as part of building, the <i>Validation Builder</i> 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 <b>Add Validation Builder to project</b> checkbox is present, enable it. Then, enable the <b>Build</b> checkbox for the desired validators, overriding the main validation preferences if necessary. See Figure 5.
<br/>
<br/>
<table>
<tr>
<td><img border="0" src="images/project-properties.png"/></td>
</tr>
<tr>
<td align="right"><em>Figure 5</em></td>
</tr>
</table>
<br/>
<br/>
Validation will now be performed on files as they are built, updating the <b>Problems</b> view automatically.
</p>
<br/>
<br/>
<h2><b>Locating Errors in the Resource</b></h2>
<p>
Further information explaining the cause of the validation error will appear in the Problems view. Selecting the error in the <b>Problems</b> view and either double-clicking on it or choosing <b>Go To</b> from its context menu will highlight the error in the Source view allowing users to quickly locate and correct the problem. See Figure 7.
</p>
<br/>
<table>
<tr>
<td><img border="0" src="images/goto.png"/></td>
</tr>
<tr>
<td align="right"><em>Figure 6</em></td>
</tr>
<tr></tr>
<tr>
<td><img border="0" src="images/results.png"/></td>
</tr>
<tr>
<td align="right"><em>Figure 7</em></td>
</tr>
</table>
</body>
</html>