W3C Validation Service Fails Rich Snippet Code
I spent a day implementing "Rich Snippet" on one page, and it all passed with flying colours using the Rich Snippet Testing Tool. Then, just as a final check, I decided to test the page on W3C, to make extra sure, and get their gold standard validation passed icon, and what happens? To my horror, W3C fails the rich snippet code with the following message.
W3C Mark-up Validation Service
Errors found while checking this document as XHTML 1.0 Transitional!
Result: 10 Errors, 1 warning(s)
Source:
Encoding: utf-8 .
Doctype: XHTML 1.0 Transitional
Root Element: htm.
Root Namespace: https:www.w3.org/1999/xhtml
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 in the chosen document type, and/or use CSS instead of this attribute.
: There is no attribute "itemscope"
: There is no attribute "itemtype"
: There is no attribute "itemprop"
: There is no attribute "annotation"
Reading the error explanation above, at first it seems as if I must have made a rookie error and used "Strict" document type. However, no, I am using the Transitional document type! Therefore, the advice it gives is not going to make any difference.
Solution
After reading many blogs I managed to figure out that, my code is actually OK it is just that Rich Snippets is not supported by HTML5 yet. It is in the interpretation of the results. The results are indicating that the document is not HTML5 compliant because it has some code in it that it does not recognise.
As a web master, where do I go from here? If I keep the Rich Snippet code then strictly speaking my page cannot be considered to have passed W3C validation. Moreover, how does Google validate the page? Will it consider the page to have errors as well?
Hence, at this point, I have no choice but to remove the rich snippet code and wait until someone creates a validation service that can check for HTML5 + Rich Snippet code.