Package org.apache.any23.validator

## Class DefaultValidator

- java.lang.Object
- - org.apache.any23.validator.DefaultValidator

- All Implemented Interfaces:
    `Validator`

      public class DefaultValidator
      extends Object
      implements Validator

  Default implementation of `Validator`.
  Author:
    Michele Mostarda (mostarda@fbk.eu), Davide Palmisano (palmisano@fbk.eu)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultValidator()` |

  - ### Method Summary

    All Methods Instance Methods Concrete 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultValidator

          public DefaultValidator()

  - ### Method Detail

    - #### validate

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

      Description copied from interface: `Validator`
      Performs a validation - fixing of the provided document.
      Specified by:
        `validate` in interface `Validator`
      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

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

      Description copied from interface: `Validator`
      Performs a validation - fixing of the provided document.
      Specified by:
        `validate` in interface `Validator`
      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

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

      Description copied from interface: `Validator`
      Allows to register a new rule to this validator and associating it to a fix.
      Specified by:
        `addRule` in interface `Validator`
      Parameters:
        `rule` - add a configured `Rule`
        `fix` - add a configured `Fix` for the rule

    - #### addRule

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

      Description copied from interface: `Validator`
      Allows to register a new rule to this validator
      Specified by:
        `addRule` in interface `Validator`
      Parameters:
        `rule` - add a configured `Rule`

    - #### removeRule

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

      Description copied from interface: `Validator`
      Allows to remove a rule from the validator and all the related `Fix`es.
      Specified by:
        `removeRule` in interface `Validator`
      Parameters:
        `rule` - `Rule` to remove

    - #### getAllRules

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

      Description copied from interface: `Validator`
      Returns all the registered rules.
      Specified by:
        `getAllRules` in interface `Validator`
      Returns:
        a not null list of rules.

    - #### getFixes

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

      Description copied from interface: `Validator`
      Returns all fixes registered for the give rule.
      Specified by:
        `getFixes` in interface `Validator`
      Parameters:
        `rule` - `Rule` to obtain fixes for.
      Returns:
        a not null list of fixes.