Package org.apache.wicket.protocol.http.documentvalidation

Examples of org.apache.wicket.protocol.http.documentvalidation.HtmlDocumentValidator


   * @param document The document
   * @return The validation result
   */
  private boolean validatePage1(String document)
  {
    HtmlDocumentValidator validator = new HtmlDocumentValidator();
    Tag html = new Tag("html");
    Tag head = new Tag("head");
    html.addExpectedChild(head);
    Tag title = new Tag("title");
    head.addExpectedChild(title);
    title.addExpectedChild(new TextContent("Paged Table Page"));
    Tag body = new Tag("body");
    html.addExpectedChild(body);

    Tag ulTable = new Tag("ul");
    ulTable.addExpectedChild(new Tag("li").addExpectedChild(new Tag("span")
        .addExpectedChild(new TextContent("one"))));
    ulTable.addExpectedChild(new Tag("li").addExpectedChild(new Tag("span")
        .addExpectedChild(new TextContent("two"))));
    // note that we DO NOT expect the third element as this is not on the current page
    body.addExpectedChild(ulTable);

    Tag ulNav = new Tag("ul");
    ulNav.addExpectedChild(new Tag("li").addExpectedChild(new Tag("span")
        .addExpectedChild(new Tag("em").addExpectedChild(new Tag("span")
            .addExpectedChild(new TextContent("1"))))));
    ulNav.addExpectedChild(new Tag("li").addExpectedChild(new Tag("a").addExpectedChild(new Tag(
        "span").addExpectedChild(new TextContent("2")))));

    body.addExpectedChild(ulNav);

    validator.addRootElement(html);

    return validator.isDocumentValid(document);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.protocol.http.documentvalidation.HtmlDocumentValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.