Rules input/output
@@@TODO refactor this doc
Input
- DOM
- CSS "XML-ised"
@@@to be completed with more details
Output
A test can produce a result with 3 levels of informations :
- Level1 (mandatory) -> PROCESS_RESULT that handles the final result of the test (and the total number of elements implied by the test)
- Level2 (mandatory) -> PROCESS_REMARK that can be either a general message associated with the result, or a message associated with an element of the DOM that needs to be treated. In this case, the type of the element, its result regarding the test, its position (line number), the source code representing it are automatically saved.
- Level3 (optional) -> EVIDENCE_ELEMENT that can store additionnal informations about the DOM element to help the qualification and thus the resolution.
The main interfaces
The ElementSelector
Explanation
This interface defines a selection applied to the DOM, to set the scope of the rule, and thus its applicability
The existing ElementSelector implementations
Here is a not exhaustive list of existing ElementSelector implementations:
- SimpleElementSelector ---> @@@TODO fix URL
- MultipleElementSelector ---> @@@TODO fix URL
- LinkElementSelector ---> @@@TODO fix URL
- ImageElementSelector ---> @@@TODO fix URL
- ...
The ElementChecker
Explanation
This interface defines a check to be done on elements
Method to implement
/**
* Perform the check operation. The instance of {@link ElementHandler}
* received as a parameter is used to retrieve elements the test is about
* and the instance of {@link TestSolutionHandler} received
* as a parameter is used to store the results of tests performed
* during the operation
*
* @param sspHandler
* @param elementHandler
* @param testSolutionHandler
*
*/
void check (
SSPHandler sspHandler,
ElementHandler elementHandler,
TestSolutionHandler testSolutionHandler);
Abstract implementation
The existing ElementChecker implementations
Here is a not exhaustive list of existing ElementChecker implementations:
- ElementPresenceChecker ---> @@@TODO fix URL
- ChildElementPresenceChecker ---> @@@TODO fix URL
- ElementUnicityChecker ---> @@@TODO fix URL
- AttributePresenceChecker ---> @@@TODO fix URL
- TextEmptinessChecker ---> @@@TODO fix URL
- TextLengthChecker ---> @@@TODO fix URL
- TextBelongsToBlackListChecker ---> @@@TODO fix URL
- DoctypeValidityChecker ---> @@@TODO fix URL
- HeadingsHierarchyChecker ---> @@@TODO fix URL
- LangChangeChecker ---> @@@TODO fix URL
- LinkPertinenceChecker ---> @@@TODO fix URL
- ...
The TextElementBuilder
Explanation
This builder is in charge of creating a textual representation of an HTML element.
Method to implement
/**
* @param element
* @return a textual representation of the element
*/
String buildTextFromElement(Element element);
Take a look at the online javadoc of the Jsoup Element.
The existing TextElementBuilder implementations
Here is the list of existing TextElementBuilder implementations:
- SimpleTextElementBuilder ---> @@@TODO fix URL
- OwnTextElementBuilder ---> @@@TODO fix URL
- TextAttributeOfElementBuilder ---> @@@TODO fix URL
- DeepTextElementBuilder ---> @@@TODO fix URL
- CompleteTextElementBuilder ---> @@@TODO fix URL
- LinkTextElementBuilder ---> @@@TODO fix URL
- PathElementBuilder ---> @@@TODO fix URL
Test context
Create a nomenclature and populate it
-- INSERT THE NOMENCLATURE
INSERT IGNORE INTO `NOMENCLATURE` (`Cd_Nomenclature`) VALUES ('MyNomenclature');
-- INSERT AN ELEMENT AND LINK IT TO THE NOMENCLATURE
INSERT IGNORE INTO `NOMENCLATURE_ELEMENT` (`DTYPE`, `Label`) VALUES`('NomenclatureElementImpl', 'Value1');
UPDATE `NOMENCLATURE_ELEMENT` SET `Id_Nomenclature`= (SELECT `Id_Nomenclature` FROM `NOMENCLATURE` WHERE `Cd_Nomenclature` LIKE 'MyNomenclature') WHERE Label like 'Value1';