In addition to the validation capability described previously, the Validating engine can also process HTML to allow pretty printing and compression. These features are particularly useful for making human readable layouts from HTML which has been compressed. In the illustration below we have compressed a corrected version of the example on the previous page. The file is then decompressed using both the pretty and safe methods. It is important to realise that no "other" data is involved here. The validator simply converts directly between the forms shown below;
Compressed:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type"><title>Solid Fluid - The home of dynamic technology</title><style type="text/css">
A {font: 10pt Arial; color: blue}
IMG {border: none}
</style></head><body><p><img
src="Image1.jpg" alt="cruft"></p><table border="0" cellpadding="0" cellspacing="0"><tr><td>Row 1;Col 1</td><td>Row 1;Col 2</td></tr><tr><td>Row
2;Col 1</td><td>Row 2;Col 2</td></tr></table></body></html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Solid Fluid - The home of dynamic technology</title>
<style type="text/css">
A {font: 10pt Arial; color: blue}
IMG {border: none}
</style>
</head>
<body>
<p>
<img src="Image1.jpg" alt="cruft"></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Row 1;Col 1</td>
<td>Row 1;Col 2</td>
</tr>
<tr>
<td>Row 2;Col 1</td>
<td>Row 2;Col 2</td>
</tr>
</table>
</body>
</html>
All of these formatting methods aim to translate the HTML without altering the way it would render in a browser. Clearly, if there are errors in the HTML which make it's meaning ambiguous, then the translation operation may not be able to hold true to this aim. Should it be the case that the source file has such an error, then the validation engine will offer the user the option to complete, or abort the operation. If completion is the chosen option, then the validator will only produce valid HTML in the modified document, but it may not render as the original did, in a browser.
The distinction between these modes is simple. The compressed mode offers a way to reduce the size of an HTML file by removing space and line breaks that not logically necassary. This mode (like all the others) will insert linebreaks, but only when a line is longer than a fixed preset, and the introduction of a linebreak will not change the way the document renders. The pretty mode aims to place each HTML tag or string on it's own new line, indented by spaces to aid reading. The safe mode aims to mimick the pretty mode but acknowledges that placing each tag on a new line introduces whitespace which affects the way a document will render. The safe mode then, will format output with tags on new lines and indenting, but it will only introduce new lines where it will not affect rendering in a browser.