HTML5 (XHTML5) Validation Schema and Intellisense for Visual Studio 2008
I’ve been playing around with HTML5 (nice intro at Smashing Magazine) for a side project, and I wanted Visual Studio 2008 to stop telling me the new elements were not valid. So I created a new Validation Schema for Visual Studio 2008 that implements much of the HTML5 spec. I found some hints on how to do this in Visual Studio 2005 and went from there. Here’s a pic of it in action giving you the attributes of of the new <source> tag under a new <video> tag:
- There is a lot of confusion about HTML, XHTML, and mime-types. I’ve chose to go with a stricter XML-like syntax of closed tags and quoted attributes, rather than the looser HTML, so I called it “XHTML 5” although that doesn’t really make it offically XHTML 5 until you do the rest of the research, work, and fun.
- This is not a 100% perfect implementation. There are bound to be different interpretations of what’s “correct” HTML5 and you have until 2022 to get it right, so please don’t worry about it too much.
- All the new elements in HTML5 have been added in the follow groupings
- structure: article, aside, footer, header, nav, section
- media: audio, video, source
- other: bb, canvas, command, datagrid, datalist, details, dialog, eventsource, figure, hgroup, keygen, mark, menu, meter, output, progress, time
- When new elements have custom attributes (such as height and width for video, I’ve tried to add those)
- I’ve also changed a few things like not requiring the type attribute on script blocks and allowing meta tags to have a charset attribute
- I’ve begun adding HTML5 events (ondrag, onplay, etc.) but have not completed all of them
- I am not sure how to add HTML5 style data- attributes, so those won’t validate yet.
How to Use it
- Download XHTML Validation Schema for Visual Studio 2008
- Save it to C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\schemas\html\
- Add the following to the Registry:
“Friendly Name”=”XHTML 5”
Note that you might need to change “Schema 23” to something else if you already have other non-default schemas installed. You just need to use the next available number in the list.
I hope you find it helpful. Please let me know if you end up using it and feel free to suggest updates or corrections.