Friday, January 20, 2012

HTML5 microdata markup validation

HTML5 introduces the microdata concept to web page design: HTML elements can semantically be annotated by using item attributes such as itemscope, itemtype and itemprop. Typically, I am using the W3C Markup Validation Service at to test my HTML5 pages and have experienced good results in checking markup validity. The good news is the bad news: the W3C validator is rather strict and—unfortunately—is too picky when it comes to microdata. For example, it reports errors detected in the shown code snippet, although this code has correct HTML5 syntax.

The code example illustrates annotation of a short text about a chemical substance. This code employs microdata (property/value pairs) according to the vocabulary defined at The W3C validator complains about the item attributes, declaring that their use is not allowed on the selected elements at this point. In contrast, the (X)HTML5 Validator at declares that this code is valid HTML5, after submitting a page containing this code snippet. The NU Markup Validation Service at came up with the same result. The latter validator—according to the statement on its site—checks the markup validity like the current W3C validation service, but instead uses the backend of the engine, which provides non-DTD-based validation support for a number of markup languages. Currently, this latter service is a potentially unstable pilot version, provided for demonstration and testing purposes only.

Suggested sites for microdata digging: 
Tutorials Point: