A beginner's guide to Validating (Was: djnyc.com - validation failure)

On Wed, Sep 21, 2005, Dan Flugger wrote:
> I'd like to redo the html on my website and
> am unable to vallidate the html from your site.
> I'm wondering if you have any tips to help me
> get started.

Hi Dan,

This is a good question - where does one start? And not an easy one to
answer, since it really depends on you and how much HTML you know. So I
will try to give an overview, which I hope you can adapt to your needs
and level.

I think, in three points, the basics are:

1- learn proper HTML

Making your web pages valid means, basically, making them "proper" HTML.
If you don't know what proper HTML looks like (as opposed to tag soup), 
then cleaning up your site is going to be very frustrating. Of course
you will learn through practice, and validating a site is an excellent
exercise for that, but a decent base level helps. 

Get a good book. There are plenty of these, and there are also horrid
ones. If you can, check the credentials of who built the books, notice
if it mentions standards, and of course flip through it to see if it
looks serious enough. That should help distinguish real HTML learning
books from snake oil.

2- take your time

So you've used the validaton on one page for the first time, and, ugh,
you get an obscene amount of errors. Forget about that number. Focus on,
say, the first 2 or 3 errors. 

Most likely, the first error will be about a doctype thing. Fix that
first, it means that your documents does not say what flavor of HTML it
is, so the validator guesses. go to
http://www.w3.org/QA/2002/04/valid-dtd-list.html
pick one flavor (try HTML 4.01 strict or transitional, that's probably a
good one to start with if you have no idea which to choose), and
copy-paste the <!DOCTYPE ... > at the top of your document, before the
<html>. 

Alternatively, the first error will be about character encoding. Maybe
your document does not declare its encoding, maybe it declares the wrong
one, maybe the server is badly configured. This sounds awful, but
usually, it can be fixed by:
- using the "encoding" drop down to try a few encodings. Usually, UTF-8
  or iso-8859-1 will do. Find one that does not cause the validator to
  panic. 
- Then check http://validator.w3.org/docs/help.html#faq-charset
  and follow the instructions to declare the encoding you found was the
  right one for your page.

Now save the document and re-run the validator on it.

Again, only focus on the first few errors. Trying to fix them all at the
same time is difficult, even risky: sometimes an error actually cascades
into a flow of other errors, so fixing the first one may make many
others disappear. So just check the first few lines of error, sometimes
they will give you context or information on what the first error is
about.

Don't forget to read the error message explanations. The error
themselves tend to be, well, obscure. The explanations below are here to
translate the error into something intelligible, and often even provide
instructions to fix the problem.

A bit of searching around may be necessary, but usually you should
manage to fix that error easily. Just remain patient, and don't assume
that the validator is wrong because you can't figure what's causing the
error. The validator does have bugs, but for some edge cases you're not
likely to fall upon. 


3- use collective wisdom

If you have not managed to fix the first error by reading the error
message explanations and flipping through your book, use the collective
wisdom of the Web to help you. 

Here are a few leads to find your answers:
- have you read through the validator's Help and FAQ? What are you
  waiting for? ->  http://validator.w3.org/docs/help.html
- There is a large archive of the www-validator list where lots
  of people before you may have struggled with the same problems.
  Look at the right of the error message, there's a strange little
  "envelope" character. Click on it and you'll be on the "feedback"
  page. Don't rush to send a plea for help just yet! There is a form
  field that can help you search the list's archive for messages on the 
  error you are facing. Give them a look, chances are you'll find your
  answer there. Then, *only* when you have checked these mail search
  results, you can send mail to the list asking for help on the error.
  Be clear, be precise, be detailed. The better your call for help is,
  the easier it will be for people to help you. And don't forget that
  the people on the mailing-list are almost all volunteers, behave
  accordingly...

Now you should be able to fix the first error. Good. Rinse, lather,
repeat until the document is clean.

Congratulations, your first page is valid. Now what? You still have
plenty other pages on your site to take care of. How? Just like you did
for the first one, step by step.

There are a few articles on the W3C QA site that explain strategies and
tools to improve the quality of a site, small or big, step by step.
Among them, check:
http://www.w3.org/QA/2003/03/web-kit
and
http://www.w3.org/QA/2002/09/Step-by-step

I hope this guide can be useful to you. 
If it's not... Tell me why -> ot@w3.org

Cheers,
-- 
olivier Thereaux - W3C - http://www.w3.org/People/olivier/
W3C Open Source Software: http://www.w3.org/Status

Received on Wednesday, 21 September 2005 23:07:56 UTC