如何测试 .Net 中字符串(网页)的标记有效性?
我编写了一个 VB.Net 页面来浏览我的网站。 它将 HttpWebResponse 存储在字符串中。 如何验证 .Net 中页面的标记有效性? - 类似于 W3 的直接输入验证选项。 我正在寻找可以识别 DOCTYPE、验证是或否并返回可以显示的失败列表的东西。
I've written a VB.Net page to browse my site. It stores the HttpWebResponse in a string. How can I validate the markup validity of the page in .Net? - something similar to W3's validate by direct input option. I'm looking for something that can identify the DOCTYPE, validate it yes or no, and return a list of failures I can display.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是有关如何执行此操作的一些信息:在 C# 中验证 XHTML(如果需要,您应该将其翻译为 VB.NET)。
还有一个可供下载的验证器模块。 唯一的缺点是字符串必须保存到物理 html 文件中。
Here's some information on how to that: Validate XHTML in C# (you should be to translate this into VB.NET if needed).
There's also a validator module available for download. The only drawback is that the string has to be saved into a physical html file.
W3C 有一个实验性 API,可以接受可能有用的代码片段,并且还有其他第三方网络服务(尽管我不是确定他们是否也可以接受片段)。
恐怕我自己曾经使用过这些,所以我无法评论它们的有效性......
The W3C have a experimental API that can accept code fragments that might be of use, and there are other 3rd Party web services (though I'm not sure if they can accept fragments) as well.
I'm afraid I have ever used these myself so I can't comment on their effectiveness...