开发者

Adding a custom target validation schema in Visual Studio

I want to use a Visual Studio 2008 web project to build an application that uses:

<!DOCTYPE vxml PUBLIC "-//W3C//DTD VOICEXML 2.1//EN" 
    "http://www.w3.org/TR/voicexml20/vxml.dtd">

as it's validation schema in an aspx file. However, when I write a tag such as <vxml></vxml> which is a valid tag in vxml.dtd, it raises a couple of warnings: Element 'html' occurs too few times开发者_运维技巧 and Element 'vxml' is not supported.

I think this is due to the Validation Target setting in Tools > Options > Text Editor > HTML > Validation.

How can I add vxml.dtd to the list of possible settings in the target dropdown box?

Thanks, Ben


Your are correct about your assumptions on the validation target and I do not think there is any way around it when using ASPX pages. You will only get the schema validation when you open it in the XML editor. You could try right clicking on the document and select "Open with..." and then open it with the XML editor. It should pick up the schema definition that you include in the vxml tag. But I have found the XML editor in VS a bit flaky and often ended up using a third party XML editor like Oxygen.

The approach I took when using ASP.NET for rendering dynamic VXML was to use XSLT and some helper classes to render the documents. That way you could get schema validation and use the XSLT debugger in VS to test how your pages are rendered. An even better approach I found is to use ASP.NET MVC 3 with Razor. There is an open source project called VoiceModel on CodePlex that provides examples on how to use this approach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜