Aug 01

vs.net and xhtml

after a recent dissapointment with an e-book on xhtml compliance and vs.net, what else can be done to help with standards based dev?

vs.net’s ‘extensibility’ options include a DefaultTargetSchema property for a project which uses a prjTargetSchema enum value, which sort of limits the extensibility to that provided by microsoft: setting this property affects intellisense and compiler errors – though earlier versions of the doco claimed that it would also alter the choice of html controls in the toolbar. prjTargetSchema has only three values which map to three xml schemas installed under \Microsoft Visual Studio .NET\Common7\Packages\schemas\html.

Now, whilst you cant easily add to the prjTargetSchema, and so change settings at a project level, you can at a document level. webforms have a targetSchema property, which allows you to specify a schema for that document. by default you can choose from one of the three that map to prjTargetSchema. but there’s nothing stopping you adding your own, and if you do the IDE will helpfully display it as an option in the designer’s dropdown.

having looked over the three provided i was about to grab the xhtml schema and do a quick xslt to make it vs.net friendly, when i found out that Christoph Schneegans had already done so. top man.

I’ve only made a couple of minor, but i think useful, alterations. Christoph’s page also includes transitional and frameset schema’s too if you’re that way inclined. Now this still doesnt make things right – you’ll still experience vs.net pain and need a good xhtml validator, but it is an improvement. here then is my list of ways to ease the pain a little:

  • change the default webform template – i include an example in the download
  • change the default editor options under Tools|Options – in HHTML/XML to:
    • deselect all ‘Apply Automatic Formatting’ options, select all ‘Automatic Formatting Options’ and ensure that all ‘Capitalisation’ options are set to ‘As entered’
    • select all on the HTML Specific page
  • install the xhtml intellisense schema – included in the download
  • always check your ouptput with a decent validator
  • Share/Bookmark

Leave a Reply

preload preload preload