JLM
JLM

Reputation: 100

validation error there is no attribute "XMLNS"

I am getting this error from w3.org validation

Error Line 2, Column 13: there is no attribute "XMLNS"

<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0">

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as marginheight (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the element to incorporate flash media in a Web page, see the FAQ item on valid flash.

How can I solve it , please see the source code of the page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0">
<head>

Upvotes: 2

Views: 6829

Answers (2)

What is happening here is you are mixing an HTML4 <!doctype> with an XHTML1 <html>.

If you want to use XHTML1, the following doctype and html must be used (thanks @1337holiday):

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

If you want the (now outdated) HTML4, use:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

If you want HTML5 (most recent), use:

<!doctype html>
<html>

Upvotes: 0

1337holiday
1337holiday

Reputation: 1954

try this instead.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>

</body>
</html>

Read this to understand the problem.

Upvotes: 2

Related Questions