Fixing HTML5 “Element ‘legend’ occurs too few times” in Visual Studio 2012

This is a minor annoyance at worst, but the VS2012 rules for <legend /> being mandatory in a <fieldset /> is wrong, legend should be optional.

If you’re like me, and refuse to stand for such things, you can easily hack a couple of files to fix it, the files are as follows:

  • C:Program Files (x86)Microsoft Visual Studio 11.0BlendHtmlSchemasenhtml_5.xsd
  • C:Program Files (x86)Microsoft Visual Studio 11.0Common7Packagesschemashtmlhtml_5.xsd
  • C:Program Files (x86)Microsoft Visual Studio 11.0Common7Packagesschemashtmlxhtml_5.xsd

In each of the files, find the following line and change minOccurs to 0:

<xsd:element name="legend" type="legendType" minOccurs="1" maxOccurs="1" />


One Response to “ “Fixing HTML5 “Element ‘legend’ occurs too few times” in Visual Studio 2012”

  1. maoyue says:

    what if there are no such files? what should i do?