Package org.htmlparser.scanners

Examples of org.htmlparser.scanners.StyleScanner


  public void testScan() throws ParserException {
    createParser("<html><head><title>Yahoo!</title><base href=http://www.yahoo.com/ target=_top><meta http-equiv=\"PICS-Label\" content='(PICS-1.1 \"http://www.icra.org/ratingsv02.html\" l r (cz 1 lz 1 nz 1 oz 1 vz 1) gen true for \"http://www.yahoo.com\" r (cz 1 lz 1 nz 1 oz 1 vz 1) \"http://www.rsac.org/ratingsv01.html\" l r (n 0 s 0 v 0 l 0) gen true for \"http://www.yahoo.com\" r (n 0 s 0 v 0 l 0))'><style>a.h{background-color:#ffee99}</style></head>");
    TitleScanner titleScanner = new TitleScanner("-t");
    parser.addScanner(titleScanner);
    parser.addScanner(new StyleScanner("-s"));
    parser.addScanner(new MetaTagScanner("-m"));
    parseAndAssertNodeCount(7);
    assertTrue(node[2] instanceof TitleTag);
    // check the title node
    TitleTag titleTag = (TitleTag) node[2];
View Full Code Here


  public StyleScannerTest(String name) {
    super(name);
  }

  public void testEvaluate() {
    StyleScanner scanner = new StyleScanner("-s");
    boolean retVal = scanner.evaluate("style ", null);
    assertEquals("Evaluation of STYLE tag", new Boolean(true), new Boolean(retVal));
  }
View Full Code Here

    assertEquals("Evaluation of STYLE tag", new Boolean(true), new Boolean(retVal));
  }

  public void testScan() {
    createParser("<STYLE TYPE=\"text/css\"><!--\n\n" + "</STYLE>", "http://www.yle.fi/");
    parser.addScanner(new StyleScanner("-s"));
    try {
      parseAndAssertNodeCount(1);
      assertTrue("Should've thrown exception", false);
    } catch (ParserException e) {
View Full Code Here

        + ".paalinkit {font-family: arial, helvetica, sans-serif; font-size:12px;}\n\n"
        + ".shortselect{font-family: arial, helvetica, sans-serif; font-size:12px; width:130;}\n\n"
        + ".cityselect{font-family: arial, helvetica, sans-serif; font-size:11px; width:100;}\n\n"
        + ".longselect{font-family: arial, helvetica, sans-serif; font-size:12px;}\n\n" + "---></STYLE>",
        "http://www.yle.fi/");
    parser.addScanner(new StyleScanner("-s"));
    parseAndAssertNodeCount(1);
    assertTrue(node[0] instanceof StyleTag);
  }
View Full Code Here

TOP

Related Classes of org.htmlparser.scanners.StyleScanner

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.