do you know about any XHTML validation library for .NET? I found that it's possible to use W3C API. But the problem I have is that I need to validate passwords protected pages or page on local server. All libraries I found are using URL as parameter for W3C validator.
Do you know about an开发者_运维百科y library?
I think you have two options: Use the .net internal classes and validate using those and a remote DTD file OR use an offline validation service.
XHTML validation happens against a DTD. The address of the DTD file should be described within the XHTML file you are trying to validate. The .net framework can use that file without any additional setup and validate against it; see here.
Using an offline validation service means that you have to install some validator and use it from within your application. The W3C validator is a good bet and can be installed on Windows too, although annoyingly. The way you check against is by creating a HttpWebRequest to the validator, feeding it your XHTML and catching the reply. There's a sample here. In the sample, you simply replace the W3C online validator with the address of your local installation of said validator.
精彩评论