Hi
I have the following code. However i would like to return validationresults for rule 1 (I have HTML which should fail 1.4.4)
I would like to se examples on how to create the validator, so that these tests are executed.
// code start
using Aspose.Html;
using Aspose.Html.Accessibility;
using ValidationResult = Aspose.Html.Accessibility.Results.ValidationResult;
var webAccessibility = new WebAccessibility();
// Initialize an object of HTMLDocument class
using (var document = new Aspose.Html.HTMLDocument(“c:\data2\123.html”))
{
Principle principle = webAccessibility.Rules.GetPrinciple(“1”);
Guideline guideline = principle.GetGuideline(“1.4”);
if (guideline != null)
{
Console.WriteLine(“{0}:{1}”, guideline.Code, guideline.Description, guideline);
foreach (var crit in guideline.GetCriterions())
{
Console.WriteLine(“{0}:{1}”, crit.Code, crit.Description);
}
}
var validator = webAccessibility.CreateValidator(builder => builder.AllLevels().AllTechnologies());
// Check the document
ValidationResult validationResult = validator.Validate(document);
// Checking for success
//if (!validationResult.Success)
{
// Get a list of Details
foreach (var detail in validationResult.Details)
{
Console.WriteLine("{0}:{1} = {2}", detail.Rule.Code, detail.Rule.Description, detail.Success);
if (!detail.Success)
{
foreach (var err in detail.Errors)
{
HTMLElement elem = (HTMLElement)err.Error.Target.Item;
Console.WriteLine("{0} ---- {1}", err.Error.ErrorMessage, elem.OuterHTML);
}
}
}
}
}
// code end
123.zip (311 Bytes)
I have used the following online service to test my html
https://websiteaccessibilitychecker.com/checker/index.php
And this site shows that it fails on criteria 1.4.4
Could someone correct my code or provide an example on how to set it up correctly.
My final goal is to create a complete list of errors in a lager HTML document.