在 Visual Studio 中添加自定义目标验证架构

发布于 2024-10-08 19:22:22 字数 463 浏览 0 评论 0原文

我想使用 Visual Studio 2008 Web 项目来构建一个应用程序,该应用程序使用:

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

aspx 文件中的验证架构。但是,当我编写诸如 之类的标签(它是 vxml.dtd 中的有效标签)时,它会引发一些警告: Element 'html' 发生次数太少不支持元素“vxml”

我认为这是由于“工具”>“验证目标”设置所致。选项>文本编辑器> HTML>验证。

如何将 vxml.dtd 添加到目标下拉框中的可能设置列表中?

谢谢, 本

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

街角迷惘 2024-10-15 19:22:22

您对验证目标的假设是正确的,我认为使用 ASPX 页面时没有任何方法可以解决它。仅当您在 XML 编辑器中打开它时,您才会获得架构验证。您可以尝试右键单击该文档并选择“打开方式...”,然后使用 XML 编辑器打开它。它应该选取您包含在 vxml 标记中的架构定义。但我发现 VS 中的 XML 编辑器有点不稳定,并且经常最终使用第三方 XML 编辑器,例如 Oxygen

当使用 ASP.NET 呈现动态 VXML 时,我采用的方法是使用 XSLT 和一些辅助类来呈现文档。这样您就可以获得架构验证并使用 VS 中的 XSLT 调试器来测试页面的呈现方式。我发现更好的方法是将 ASP.NET MVC 3 与 Razor 结合使用。 CodePlex 上有一个名为 VoiceModel 的开源项目,它提供了有关如何使用此方法的示例

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文