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.
+3
A:
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.
Jose Basilio
2009-05-05 22:32:17
@José, I used both links. I translated the code in the first link to VB and tweaked it a bit to validate HTML in automated crawls of my site. It works OK - it does some basic checking.Now the module in the second link is just cool. Very slick, very easy. It can validate additional HTML/Pages in my dev environment that an autonomous crawl can't access.I also overrode MyBase.Render to capture all output (of course I can turn this on and off), save it to a file, and run it through an automated validator later - to catch unique HTML a particular user might see.Very useful. Thanks.
rvarcher
2009-05-06 22:35:08
+1
A:
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...
CJM
2009-05-05 23:27:10