public void ShouldntExplode() { var validator = new W3CValidator(new HttpClient(), new Soap12ValidationResponseParser()); var validationReport = validator.ValidateDocument(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd""><html xmlns=""http://www.w3.org/1999/xhtml""><head><title>test</title></head><body><p>hello</p></body></html>"); Assert.AreEqual(true, validationReport.Validity); }
public static void Main(string[] args) { W3CValidator htmlValidator = new W3CValidator(); CSSValidator cssValidator = new CSSValidator(); //MuonKit.W3cValidationClient.Html.ValidationReport reportHtml = htmlValidator.ValidateDocument (@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd""><html xmlns=""http://www.w3.org/1999/xhtml""><head><title>test</title></head><body><p><div>hello</p></body></html>", null, null); MuonKit.W3cValidationClient.Css.ValidationReport reportCss = cssValidator.ValidateUri("http://anuragbhandari.com", "all", "css3"); //MuonKit.W3cValidationClient.Css.ValidationReport reportCss = cssValidator.ValidateDocument("body { color:black; }"); Console.WriteLine(""); }
static void Main(string[] args) { var validator = new W3CValidator(new HttpClient(), new Soap12ValidationResponseParser()); var validationReport = validator.ValidateDocument(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd""><html xmlns=""http://www.w3.org/1999/xhtml""><head><title>test</title></head><body><p><p>hello</p></p></body></html>"); if (validationReport.Validity) { Console.WriteLine("YAY!"); } else { Console.WriteLine("NAY."); foreach (var e in validationReport.Errors) { Console.WriteLine("{0}:{1} {2}", e.Line, e.Column, e.Message); } } }
public JsonResult ValidateCSS(PostFile file) { return(Json(W3CValidator.ValidateSingleFile(file.FileName, file.Text))); }