Package org.apache.any23.validator

## Interface Validator

- All Known Implementing Classes:
    `DefaultValidator`

      public interface Validator

  The validator class allows to perform validation - correction of related to HTML `Document` instances.
  Author:
    Michele Mostarda (mostarda@fbk.eu), Davide Palmisano (palmisano@fbk.eu)

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addRule​(Class<? extends Rule> rule)` | Allows to register a new rule to this validator
    `void` | `addRule​(Class<? extends Rule> rule, Class<? extends Fix> fix)` | Allows to register a new rule to this validator and associating it to a fix.
    `List<Class<? extends Rule>>` | `getAllRules()` | Returns all the registered rules.
    `List<Class<? extends Fix>>` | `getFixes​(Class<? extends Rule> rule)` | Returns all fixes registered for the give rule.
    `void` | `removeRule​(Class<? extends Rule> rule)` | Allows to remove a rule from the validator and all the related `Fix`es.
    `ValidationReport` | `validate​(URI documentIRI, Document document, boolean applyFix)` | Performs a validation - fixing of the provided document.
    `ValidationReport` | `validate​(DOMDocument document, boolean applyFix)` | Performs a validation - fixing of the provided document.

- - ### Method Detail

    - #### validate

          ValidationReport validate​(DOMDocument document,
                                    boolean applyFix)
                             throws ValidatorException

      Performs a validation - fixing of the provided document.
      Parameters:
        `document` - the `DOMDocument` instance wrapping the original HTML document.
        `applyFix` - if `true` tries to fix the document.
      Returns:
        a report of the detected issues.
      Throws:
        `ValidatorException` - if an error occurs during the validation process.

    - #### validate

          ValidationReport validate​(URI documentIRI,
                                    Document document,
                                    boolean applyFix)
                             throws ValidatorException

      Performs a validation - fixing of the provided document.
      Parameters:
        `documentIRI` - the document source IRI.
        `document` - the original HTML document.
        `applyFix` - if `true` tries to fix the document.
      Returns:
        a report of the detected issues.
      Throws:
        `ValidatorException` - if an error occurs during the validation process.

    - #### addRule

          void addRule​(Class<? extends Rule> rule)

      Allows to register a new rule to this validator
      Parameters:
        `rule` - add a configured `Rule`

    - #### addRule

          void addRule​(Class<? extends Rule> rule,
                       Class<? extends Fix> fix)

      Allows to register a new rule to this validator and associating it to a fix.
      Parameters:
        `rule` - add a configured `Rule`
        `fix` - add a configured `Fix` for the rule

    - #### removeRule

          void removeRule​(Class<? extends Rule> rule)

      Allows to remove a rule from the validator and all the related `Fix`es.
      Parameters:
        `rule` - `Rule` to remove

    - #### getAllRules

          List<Class<? extends Rule>> getAllRules()

      Returns all the registered rules.
      Returns:
        a not null list of rules.

    - #### getFixes

          List<Class<? extends Fix>> getFixes​(Class<? extends Rule> rule)

      Returns all fixes registered for the give rule.
      Parameters:
        `rule` - `Rule` to obtain fixes for.
      Returns:
        a not null list of fixes.