简体   繁体   中英

How do I validate a html file with C#?

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 any idea how can I do this?

我将运行W3C标记验证服务的本地实例,并通过API与之通信

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

This is relevant to your question:

Looking for C# HTML parser

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM