Re: Validator not much cop

Tatham Oddie wrote:

> All of the errors reported by the validator seem accurate to me.

They are usually accurate, though not always easy to understand without 
knowing SGML or XML. The explanations after the error messages help to see 
what the point is, in most cases, though they are inevitably somewhat 
generic.

> B) attributes like width, height and background can't be used on
> tables (they should be applied via CSS instead)

The width attribute is valid

> C) you have a lot of text wrapped in br tags (for example: <br>Floor
> 2, 1 Livsey Street</br>) but this isn't valid as the br element isn't
> allowed to contain content.

A typical misunderstanding caused by an attempt to use XHTML. When the 
author has started using XHTML, it is probably best to proceed in that path, 
but it means that one needs read a good tutorial on XHTML.

> Most of these instances seem to be
> addresses, which could be marked up like the following instead:
>
>     <address>
>         Floor 2, 1 Livsey Street<br/>
>         Some suburb<br/>
>         ABC123 UK
>     </address>

In the specific case of the address for the document author, yes. That's 
what <address> means by definition. If there are other addresses and they 
need to be fixed syntactically anyway, it is best to fix them in a 
semantically correct way. In that case there is no better markup than <div>, 
optionally with a class="..." attribute to make styling easier. Within a div 
element, you could use inner div elements, so that each line would be 
written as <div>...</div>, resembling the structure that the current invalid 
markup is supposed to represent.

> Those three approaches will get you most of the way there, but you
> still have some invalid tag nesting. (Something is missing the close
> tag, which is likely to break your layout in strange ways.)

Fixing the errors already pointed out helps with most of the problems if not 
all, and it will be much easier to see the remaining problems, if any. A the 
end of line 169, there is an unmatched </br>, which causes somewhat 
confusing error messages, but using just <br /> tags instead of <br> and 
</br> (or using <div>...</div> markup) should fix this.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 

Received on Tuesday, 3 November 2009 06:25:09 UTC