wicket.protocol.http.documentvalidation
Class HtmlDocumentValidator

java.lang.Object
  extended by wicket.protocol.http.documentvalidation.HtmlDocumentValidator

public class HtmlDocumentValidator
extends java.lang.Object

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

Constructor Summary
HtmlDocumentValidator()
          Create the validator.
 
Method Summary
 void addRootElement(DocumentElement e)
          Add a root element to the validator.
 boolean isDocumentValid(java.lang.String document)
          Check whether the supplied document is valid against the spec that has been built up within the validator.
 void setSkipComments(boolean skipComments)
          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
 

Constructor Detail

HtmlDocumentValidator

public HtmlDocumentValidator()
Create the validator.

Method Detail

addRootElement

public void addRootElement(DocumentElement e)
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.

Parameters:
e - The element to add

isDocumentValid

public boolean isDocumentValid(java.lang.String document)
Check whether the supplied document is valid against the spec that has been built up within the validator.

Parameters:
document - The document to validate
Returns:
Whether the document is valid or not

setSkipComments

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.

Parameters:
skipComments - Whether to skip comments or not


Copyright © 2004-2007 Wicket developers. All Rights Reserved.