Validation

The World Wide Web Consortium (W3C) has a validation service that checks html documents for conformance to particular standards. The standard is normally specified in the doctype identifier at the beginning of a document. The validation is a web based service, so you need to have access to the internet to use it.

Validators are simple to use and not only does it check for conformance of a document but it also provides useful feedback for updating your document to be valid according to a particular standard specification.

A web browser is a very forgiving program and it may well display your html document but this is no guarantee that the document is correct.

You can think of validation as a two step process. A document that follows partticular syntactical rules, such as all opening tags must have matching closing tags, is said to be well formed but not necessarily valid. A valid document has to be well formed and be marked up according to a particular html specification.

Well Formed Douments

Well formdness is all about grammer or rules. The rules are in fact the XML set of rules for encoding documents in machine readable form. The X in XHTML, comes from the first HTML specification implemented using XML syntax.

  • XHTML is well formed, however, HTML5 is more flexible and leaves a choice. We will continue to use the XML well formed syntax and keep to HTML5 elements.
  • Editors generally highlight well formdness type errors and we shall use the W3C validator for the Document Type Definition(DTD) validation.

HTML Exercise - HTML Document Structure

We will use the structure.html file you saved in the previous tutorial.

Validating XML well-formdness

  1. Open the file, structure.html in Firefox.
  2. Righ-mouse click and select View Page Source.
  3. Any errorneous code are highlighted in red.

Validating HTML5 conformance

  1. Browse to http://validator.w3.org.
  2. Use the "file upload" option on the validator site; select the structure.html file, and validate.
  3. For html5, the validators are currently in development; also try this alternative validator.