Forum Moderators: open

Message Too Old, No Replies

Validation error on my meta description

that I don't understand

         

John_Caius

5:34 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've got the following meta tag in the head section of the page:

<meta name="description" content="description of my site" />

The new W3C validator throws up the following error:

Line 1, column 304: character data is not allowed here

...end of description" /><meta name="keywords" content="start of keywords

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p> ) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).

highlighting the end > of the meta description tag.

Have I made some simple error somewhere?

Thanks. :)

pageoneresults

5:36 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Instead of...

<meta name="description" content="description of my site" />

Do this...

<meta name="description" content="description of my site"></meta>

This discussion came up about a year ago and the above

</meta>
was the solution.

I'm not sure what is going on with the W3 in this instance, it could be a bug of some sort.

John_Caius

6:45 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Tried that. Changed the meta description tag, got the new error:

Line 1, column 384: end tag for element "META" which is not open

...end of description"></meta>

highlighting the new </meta> tag.

tedster

8:20 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe a dumb question, but you are using a proper XHTML DTD, right?

John_Caius

8:30 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hm, not such a dumb question...

encyclo

9:42 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As mentioned in this thread [webmasterworld.com], if you're using XHTML notation with an HTML doctype, the new validator throws an error. You should simply have:

<meta name="description" content="description of my site">

And the site will validate correctly as HTML 4.01. Same thing for other tags, too: <br> instead of <br />, etc.

John_Caius

10:07 am on Apr 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, changed to an xhtml doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

and get

DTD did not contain element declaration for document type name

I'm also getting a bug where it doesn't like <html> at the top of the code after the DTD - should that be <xhtml>?

encyclo

12:43 pm on Apr 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want to use XHTML, you need to declare the XML namespace on the HTML tag, thus:

<html [b]xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"[/b]>

You may also get errors related to CaPitaliZation of other elements - you need to make sure everything is in lower case (including stuff like onclick).

John_Caius

3:18 pm on Apr 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, thanks. :)

pageoneresults

3:41 pm on Apr 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can shorten the above to...

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

The language attribute is deprecated.