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:

Readme.txt

  • 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.

What’s Finished

  • 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

  1. Download XHTML Validation Schema for Visual Studio 2008
  2. Save it to C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\schemas\html\
  3. Add the following to the Registry:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages\{1B437D20-F8FE-11D2-A6AE-00104BCC7269}\Schemas\Schema 23]
    “Friendly Name”=”XHTML 5”
    “URI”=”http://schemas.microsoft.com/intellisense/xhtml5
    “File”=”html\\xhtml5.xsd”

    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.

18 thoughts on “HTML5 (XHTML5) Validation Schema and Intellisense for Visual Studio 2008

  1. I would love to, but I’m haven’t yet secured rights to a Spanish text that has lexical information. If you know of one, let me know!

  2. You should actually have a read of the HTML5 spec before you do this sort of thing. The fact that you’re using quoted attributes and a "/" in your void elements does not mean you’re using XHTML5 as these are aloud both in HTML5 and XHTML5. The primary difference between HTML5 and XHTML5 is that HTML5 is processed by a HTML parser, and XHTML5 is processed by a XML parser. It’s not like HTML4/XHTML1 were the differences were only in syntax (according to the W3C validator etc).

  3. Awesomeness.
    As I said, I realize there is plenty of confusion/debate around the specs, syntax, and mimetype issues. This is just a way to get the HTML5 tags to show up in Visual Studio and go with the stricter XML-like syntax of closed tags than the looser HTML style. After that, you have to make the other decisions.

  4. Hi John,
    First of all, thank you for your hard work!
    I followed the steps you mentioned.
    One problem I encountered was I could not find the Packages folder inside the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\ in the registry editor.
    So, I created a reg file to create the extra folders and add those keys you specified.
    After restarting my machine, I still cannot get VS2008 to recognize the html5 tags.
    Is there anything I missed?
    A side note:
    When I hovered over to the green warning line, VS is validating the tags using XHTML 1.0 Transitional. When I wanted to change the HTML Validation setting to HTML 5, I could not find the option.
    Thanks,
    Vivian

  5. Hi John, I can’t download the XSD file (the link gives a 404 error).
    Can you fix it?
    thanks in advance for your work

  6. John,
    I am getting a bad link also when trying to grab the XSD file. Do you still have this schema file available for download?
    Thanks.

Comments are closed.