Re: Is the id-attribute not validated correctly?

On Mon, 19 Mar 2007, Johannes Athmer wrote:

> when I tried to validate my page in the Total Validator[1], it gave me
> their error code E622 on invalid id-attributes like the ASP.NET
> "__VIEWSTATE".

I had not heard of Total Validator previously, I think, but it looks like 
an interesting effort at a combined checker. As far as I know, it is not 
affiliated with the W3C Markup Validator or the W3C in general.

> However, when I searched the net for other developers
> having problems with validating ASP.NET pages, they said that they
> validate. And they do validate with the W3C validator.

I just checked, and the W3C Markup Validator correctly reports an id value 
starting with "_" in an HTML 4.01 document as an error, just as Total 
Validator does (well, in a different wording).

I guess the other developers are using XHTML, where an "_" is allowed as 
the first character of an identifier, by XML rules. It's not recommended 
for compatibility reasons, see C.8 Fragment Identifiers in Appendix C,
http://www.w3.org/TR/xhtml1/#C_8
(which is confusing, really, but it's a place where this difference 
between HTML 4.01 and XHTML 1.0 is explained). But it's definitely valid.

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

Received on Monday, 19 March 2007 22:04:45 UTC