Class XHTMLValidator


  • public class XHTMLValidator
    extends java.lang.Object
    This validator executes JTidy to check the returned HTML code for standard conformance. It supports different level of stoppage in case of validation problems.
    • Constructor Summary

      Constructors 
      Constructor Description
      XHTMLValidator​(boolean breakOnErrors, boolean breakOnWarnings)
      Constructor.
    • Constructor Detail

      • XHTMLValidator

        public XHTMLValidator​(boolean breakOnErrors,
                              boolean breakOnWarnings)
        Constructor.
        Parameters:
        breakOnErrors - should we issue an assertion in case of errors
        breakOnWarnings - should we issue an assertion in case of warnings
    • Method Detail

      • validate

        public void validate​(HtmlPage page)
                      throws java.lang.Exception
        Validates the specified HTML page.
        Parameters:
        page - the page to check
        Throws:
        java.lang.AssertionError - if the page fails validation
        java.lang.Exception
      • validate

        public void validate​(LightWeightPage page)
                      throws java.lang.Exception
        Validates the specified lightweight HTML page.
        Parameters:
        page - the page to check
        Throws:
        java.lang.AssertionError - if the page fails validation
        java.lang.Exception
      • validate

        public void validate​(java.lang.String content)
                      throws java.lang.Exception
        Does the validation and raises an exception if configured. You can use this method directly, but it is encouraged to use the default validator method instead.
        Parameters:
        content - the page to validate
        Throws:
        java.lang.Exception - an exception in case of an error
      • getInstance

        public static XHTMLValidator getInstance()
        Returns the an instance of this validator. The validation itself can be switched ON/OFF by property.

        Note, assuming the validator is enabled by property, it will stop on ALL errors and ALL warnings.

        Returns:
        the default instance