Re: Validator doesn't complain about & in meta content

On Tue, 27 Sep 2005, Edmondson, Michael wrote:

>    <meta name="Title" content="I like XML & XSL!">
>    <meta name="Description" content="I like M&Ms.  Yum!">
- -
> Expectation
> -----------
> The Validator should complain about ampersands not represented as entities.

Wrong expectation in SGML validation (which you are using). By SGML rules,
an ampersand is allowed as a data character when not immediately followed 
by a name start character or by the number sign "#".

> The Validator only complains about the second mistake, finding an invalid
> entity.

Technically, it is an undefined entity reference, but the net effect is 
that the document is invalid. (If you had e.g. "I like nice&shy people"
instead, the document would be valid, since &shy is a correct entity 
reference by HTML 4 rules. In XHTML, it would be invalid due to the lack 
of the terminating ";".)

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

Received on Wednesday, 28 September 2005 04:58:55 UTC