Simple class that provides a convenient programmatic way to define what an expected HTML document
should look like and then to validate a supplied document against this template. Note that this
validator expects very clean HTML (which should not be a problem during testing). In particular
it expects tags to be matched and that the following tags with optional close tags are actually
closed: p, td, th, li and option.
Author: Chris Turner
Modifier and Type
Method and Description
( addRootElement DocumentElement e)
Add a root element to the validator.
( isDocumentValid String document)
Check whether the supplied document is valid against the spec that has been built up within
(boolean skipComments) setSkipComments
Set whether to skip comments of not when validating.
Methods inherited from class java.lang.
Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void addRootElement(
Add a root element to the validator. This will generally be the HTML element to which all
children are added. However, it may also be other elements to represent comments or similar.
e - The element to add
public void setSkipComments(boolean skipComments)
Set whether to skip comments of not when validating. The default is true. If this is set to
false then Comment elements must be added to represent each comment to be validated.
skipComments - Whether to skip comments or not
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.