Package org.htmlparser.scanners

Examples of org.htmlparser.scanners.FormScanner


  public void testScanFormWithPreviousOpenLink() throws ParserException {
    createParser("<A HREF=\"http://www.oygevalt.org/\">Home</A>\n" + "<P>\n" + "And now, the good stuff:\n"
        + "<P>\n" + "<A HREF=\"http://www.yahoo.com\">Yahoo!\n" + "<FORM ACTION=\".\" METHOD=\"GET\">\n"
        + "<INPUT TYPE=\"TEXT\">\n" + "<BR>\n" + "<A HREF=\"http://www.helpme.com\">Help</A> "
        + "<INPUT TYPE=\"checkbox\">\n" + "<P>\n" + "<INPUT TYPE=\"SUBMIT\">\n" + "</FORM>");
    parser.addScanner(new FormScanner("", parser));
    parser.addScanner(new LinkScanner());
    parseAndAssertNodeCount(6);
    assertTrue("Fifth Node is a link", node[4] instanceof LinkTag);
    LinkTag linkTag = (LinkTag) node[4];
    assertEquals("Link Text", "Yahoo!\r\n", linkTag.getLinkText());
View Full Code Here


  public void testFormScanningShouldNotHappen() throws Exception {
    String testHTML = "<HTML><HEAD><TITLE>Test Form Tag</TITLE></HEAD>"
        + "<BODY><FORM name=\"form0\"><INPUT type=\"text\" name=\"text0\"></FORM>" + "</BODY></HTML>";
    createParser(testHTML);
    parser.registerScanners();
    parser.removeScanner(new FormScanner("", parser));
    Node[] nodes = parser.extractAllNodesThatAre(FormTag.class);
    assertEquals("shouldnt have found form tag", 0, nodes.length);
  }
View Full Code Here

TOP

Related Classes of org.htmlparser.scanners.FormScanner

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.