Package org.htmlparser.tags

Examples of org.htmlparser.tags.BodyTag


        parseAndAssertNodeCount(1);
        assertTrue("Only node should be an HTML node",node[0] instanceof Html);
        Html html = (Html)node[0];
        assertTrue("HTML node should have one child",1 == html.getChildCount ());
        assertTrue("Only node should be an BODY node",html.getChild(0) instanceof BodyTag);
        BodyTag body = (BodyTag)html.getChild(0);
        assertTrue("BODY node should have one child",1 == body.getChildCount ());
        assertTrue("Only node should be a string node",body.getChild(0) instanceof Text);
        Text stringNode = (Text)body.getChild(0);
        String actual = stringNode.getText();
        assertEquals("Third node has incorrect text","text<>\ntext",actual);
    }
View Full Code Here


    BodyScanner bodyScanner = new BodyScanner("-b");
    parser.addScanner(bodyScanner);
    parseAndAssertNodeCount(6);
    assertTrue(node[4] instanceof BodyTag);
    // check the body node
    BodyTag bodyTag = (BodyTag) node[4];
    assertEquals("Body", "This is a body tag", bodyTag.getBody());
    assertEquals("Body", "<BODY>This is a body tag</BODY>", bodyTag.toHtml());
    assertEquals("Body Scanner", bodyScanner, bodyTag.getThisScanner());
  }
View Full Code Here

    BodyScanner bodyScanner = new BodyScanner("-b");
    parser.addScanner(bodyScanner);
    parseAndAssertNodeCount(6);
    assertTrue(node[4] instanceof BodyTag);
    // check the body node
    BodyTag bodyTag = (BodyTag) node[4];
    assertStringEquals("Body", "<BODY><%=BodyValue%></BODY>", bodyTag.toHtml());
    assertEquals("Body Scanner", bodyScanner, bodyTag.getThisScanner());
  }
View Full Code Here

    BodyScanner bodyScanner = new BodyScanner("-b");
    parser.addScanner(bodyScanner);
    parseAndAssertNodeCount(6);
    assertTrue(node[4] instanceof BodyTag);
    // check the body node
    BodyTag bodyTag = (BodyTag) node[4];
    assertEquals("Body", "<BODY>before jsp<%=BodyValue%>after jsp</BODY>", bodyTag.toHtml());
    assertEquals("Body Scanner", bodyScanner, bodyTag.getThisScanner());
  }
View Full Code Here

    BodyScanner bodyScanner = new BodyScanner("-b");
    parser.addScanner(bodyScanner);
    parseAndAssertNodeCount(3);
    assertTrue(node[1] instanceof BodyTag);
    // check the body node
    BodyTag bodyTag = (BodyTag) node[1];
    assertEquals("Body", "<BODY>before jsp<%=BodyValue%>after jsp</BODY>", bodyTag.toHtml());
    assertEquals("Body Scanner", bodyScanner, bodyTag.getThisScanner());
  }
View Full Code Here

  public String[] getID() {
    return MATCH_NAME;
  }

  public Tag createTag(TagData tagData, CompositeTagData compositeTagData) {
    return new BodyTag(tagData, compositeTagData);
  }
View Full Code Here

        // first we check to see if body tag has a
        // background set and we set the NodeIterator
        // to the child elements inside the body
        if (node instanceof BodyTag) {
          BodyTag body = (BodyTag) node;
          binUrlStr = body.getAttribute("background");
          // if the body tag exists, we get the elements
          // within the body tag. if we don't we won't
          // see the body of the page. The only catch
          // with this is if there are images after the
          // closing body tag, it won't get parsed. If
          // someone puts it outside the body tag, it
          // is probably a mistake. Plus it's bad to
          // have important content after the closing
          // body tag. Peter Lin 10-9-03
          e = body.elements();
        } else if (node instanceof BaseHrefTag) {
          BaseHrefTag baseHref = (BaseHrefTag) node;
          String baseref = baseHref.getBaseUrl().toString();
          try {
            if (!baseref.equals(""))// Bugzilla 30713
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.BodyTag

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.