Friday, November 14, 2008

Validation

Is validation some kind of quality control? Does "valid" mean "quality approved by W3C"?
Validity is one of the quality criteria for a Web page, but there are many others. In other words, a valid Web page is not necessarily a good web page, but an invalid Web page has little chance of being a good web page.
For that reason, the fact that the W3C Markup Validator says that one page passes validation does not mean that W3C assesses that it is a good page. It only means that a tool (not necessarily without flaws) has found the page to comply with a specific set of rules. No more, no less. This is also why the "valid ..." icons should never be considered as a "W3C seal of quality".


Is validity the same thing as conformance?
No, they are different concepts.
Markup languages are defined in technical specifications, which generally include a formal grammar. A document is valid when it is correctly written in accordance to the formal grammar, whereas conformance relates to the specification itself. The two might be equivalent, but in most cases, some conformance requirements can not be expressed in the grammar, making validity only a part of the conformance.


What is the Markup Validator and what does it do?
The Markup Validator is a free tool and service that
validates markup: in other words, it checks the syntax of Web documents, written in formats such as (X)HTML.
The Validator is sort of like lint for C. It compares your HTML document to the defined syntax of HTML and reports any discrepancies.

Why should I validate my HTML pages?
One of the important maxims of computer programming is: Be conservative in what you produce; be liberal in what you accept.
Browsers follow the second half of this maxim by accepting Web pages and trying to display them even if they're not legal HTML. Usually this means that the browser will try to make educated guesses about what you probably meant. The problem is that different browsers (or even different versions of the same browser) will make different guesses about the same illegal construct; worse, if your HTML is really pathological, the browser could get hopelessly confused and produce a mangled mess, or even crash.
That's why you want to follow the first half of the maxim by making sure your pages are legal HTML. The best way to do that is by running your documents through one or more HTML validators.