–– workshop home ––

Workshops

Using Validators

Introduction and Overview

How validation works

Validation software has a database it draws from. The database contains the rules. The software compares the code against the rules and any place it sees a discrepancy, it flags that and reports it back to you.

It's up to you both to understand the report and to fix the code.

Because it's software, it is limited in its reading of the code. Sometimes it will report things as wrong (or, more commonly, as possibly wrong) and it's up to you to realize it isn't wrong.

All the software used in this workshop also cites the W3 or WCAG spec that defines proper usage.

You can submit only one page at a time. There's commercial software you can buy that will check whole sites, but it's generally expensive and I haven't tested any of it.

Whenever you edit a page, you potentially should re-validate. Use your own judgment.

The database on which the software is based can get out of date. It can also contain errors, especially when it's a matter of interpretation. You must always read the reports with a critical eye.

Validating HTML at the W3

http://validator.w3.org/

Levels of Problems

Most likely: it will claim your doctype is wrong, or a variety of things associated with that.

Examples

http://boisestate.edu/webcenter/workshops/validators/presenternotes.shtml

This Page Is Valid HTML 4.01 Strict!
Green is good.

http://oit.boisestate.edu/

Thirty-one errors here, when I ran a validation on 3-27-2008. Many were due to simple improper coding, easily fixed. Many of these came from the old university header, which was badly coded and that got replicated all over the place. There are spacer gifs that generate missing alt tag errors, and others that are decorative gifs.

Validation can also catch genuine errors, though. For example, the very last error:
Line 22, Column 85: reference to non-existent ID "SEARCHTEXT".
indicates that the label and the id don't match on a form. Not fatal, but definitely ought to be fixed.

In general, on files that have include files, the line numbering won't match. Use search.

http://www.tacobellarena.com/

Fifty-one errors here. All kinds of problems.

http://boisestate.edu/courses/latemiddleages/pazzi/13.shtml

This one returns two errors. The problem is that I initially thought of these as unique and so designated them as IDs. I later decided I wanted to repeat the internal navigation at the bottom of each page, so I just copied the code. I'm going to have to do a search and replace and change all instances to class instead.

The point here is that in many cases the validation indicates what might be a problem. It's up to the human to decide how much of a problem it is.

Typical Problems

This is a list of messages that I see often. It's far from comprehensive! I've also included a few where I think the explanation from the W3 is unusually obscure. They've gotten much better in their explanations, but sometimes they can still be pretty mysterious.

The message from the validator looks like this, with my explanation in normal type.

  1. No Character Encoding Found! Falling back to UTF-8.
    You left out the character encoding.
  2. there is no attribute "LEFTMARGIN".
    What is between the quotes will vary, but they all mean much the same thing: you have put in an attribute that is no longer valid and what you are trying to accomplish needs to be done from the stylesheet.
  3. required attribute "ALT" not specified.
    The /> ending must be used in XHTML but must not be used in HTML
  4. Unable to Determine Parse Mode!
    You have not declared whether this is html or xml or what, forcing the validator to guess. If the validator has to guess, so does the browser.
  5. required attribute "TYPE" not specified.
    Often left out of a Javascript <script> tag.

Validating CSS at the W3

Same basic issues as with validator

The address is http://jigsaw.w3.org/css-validator/

Examples

http://boisestate.edu/webcenter/workshops/validators/presenternotes.shtml

Congratulations! No Error Found.
This document validates as CSS level 2.1 !

Yay!

http://oit.boisestate.edu/

This one causes an error on the server. Yikes! The problem derives from some hacks in the CSS to deal with IE.

http://www.tacobellarena.com/

Only two errors here, both the same: failure to indicate a unit of measurement.

http://boisestate.edu/courses/latemiddleages/pazzi/13.shtml

Congratulations! No Error Found.
This document validates as CSS level 2.1 !

Yay!

Validating for Accessibility

http://www.cynthiasays.com/

The chief aggravation here is that you can test no more frequently than once a minute. This is aggravating when you make a quick change and want to check it. They do have software you can buy.

You will want to validate to Section 508, which is the default.

Other Tools

Dreamweaver has something built in for accessibility testing.

You can buy software that will test your whole site for all sorts of things.

But there's no substitute for proofreading and human testing. Check it yourself. If it's really important, get others to check it as well.