Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
July 13, 2007, 6:11 pm
rate this thread
I face some problem in validating my HTML documents against w3 web
Since I have lots of documents to be verified, I use a c# .Net web
application to access the web service and provide input through that
application. I try to provide a file which contains html data to the
But the web service is not able to read the file content. The below
exception message is always displayed when i try to upload my file.
"Sorry! This document can not be checked.
Sorry, I could not find any content to validate. It is probable that
you clicked on the "check" button without choosing a URL, a file or
entering the content of the document you would like to validate.
Read the User's guide for quick instructions on using this validator."
Please help me in this regard.
Below is my code.
WebRequest request = WebRequest.Create("http://validator.w3.org/check ?
request.Method = "POST";
request.ContentType = "multipart/form-data;";
request.Credentials = CredentialCache.DefaultCredentials;
Stream requestStream = request.GetRequestStream();
FileStream loFile = new FileStream(@"C:\test.htm",
lcFile = new byte[loFile.Length];
loFile.Read(lcFile, 0, (int)loFile.Length);
int index = 0;
foreach (char c in text.ToCharArray())
lcFile[index++] = Convert.ToByte(c);
requestStream.Write(lcFile, 0, lcFile.Length);
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
StreamReader sr = new StreamReader(responseStream);
string outputFromStream = sr.ReadToEnd();
Re: XHTML Validation Error while using w3 validator service
Me thinks that it's more convenient in many cases to use an off-line
validator; validate as you mark it up, before you publish, etc. E.g. as
a matter of routine, before publishing, I preview my pages in browsers +
an off-line validator.¹
¹ Valtti offline-validator 1.2 <URL:
GUI in Finnish or English.