Is it possible to validate the xmlns:fb (Facebook) attribute?

DisgruntledGoat picture DisgruntledGoat · Jan 1, 2012 · Viewed 24k times · Source

I have a Facebook Like button on my site and as such also have the xmlns:fb attribute on the <html> tag:

<!DOCTYPE html>
<html lang="en" xmlns:fb="http://www.facebook.com/2008/fbml">

However, when running my site through the W3C validator, I get these errors:

Line 2, Column 61: Attribute xmlns:fb not allowed here.

Line 2, Column 61: Attribute with the local name xmlns:fb is not serializable as XML 1.0.

Line 222, Column 72: Attribute fb:like:layout is not serializable as XML 1.0.

Line 222, Column 72: Attribute fb:like:layout not allowed on element a at this point.

It is my understanding that using the xmlns:fb attribute adds fb to the document namespace, so that using any <fb: element is valid. Is that not the case? Is it a HTML5 issue?

I also have similar validation errors with the Twitter button, is it possible to fix those as well?

Line 223, Column 53: Attribute tw:via is not serializable as XML 1.0.

Line 223, Column 53: Attribute tw:via not allowed on element a at this point.

Answer

Jeremy French picture Jeremy French · Dec 17, 2012

Or you can now use prefix mappings.

<!DOCTYPE html>
<html lang="en" prefix="fb: http://www.facebook.com/2008/fbml">