开发者

How do I validate a html file with C#?

开发者 https://www.devze.com 2023-01-18 11:10 出处:网络
I have a C# application that receives an html file. I want to parse and validate it. On output it will return a list of errors or that my html is valid.

I have a C# application that receives an html file. I want to parse and validate it. On output it will return a list of errors or that my html is valid.

Has anyone an开发者_开发百科y idea how can I do this?


I'd run a local instance of the W3C Markup Validation service and communicate with it via the API


You can use HTML Tidy. There is a wrapper for .NET called TidyManaged


There is an obscure DLL in the framework version 1.0 (!) Microsoft.mshtml.dll and that is the only way in the framework to deal with DOM. If HTML is XHTML and a valid XML, then you can use XML but otherwise this is the only chance.

0

精彩评论

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