Package org.htmlparser.tags

Examples of org.htmlparser.tags.Tag.toHtml()


    Hashtable tempHash = tag.getAttributes();
    tempHash.put("BORDER", "1");
    tag.setAttributes(tempHash);

    String s = tag.toHtml();
    assertEquals("HTML should be", "<TABLE BORDER=\"1\" >", s);
  }
}
View Full Code Here


    // The second node should be a normal tag
    assertTrue("Node 2 should be an Tag", node[1] instanceof Tag);
    Tag htag = (Tag) node[1];
    assertStringEquals("Contents of the tag",
        "jsp:useBean id=\"transfer\" scope=\"session\" class=\"com.bank.PageBean\"", htag.getText());
    assertStringEquals("html", "<JSP:USEBEAN ID=\"transfer\" SCOPE=\"session\" CLASS=\"com.bank.PageBean\"/>", htag
        .toHtml());
    // The third node should be an HTMLJspTag
    assertTrue("Node 3 should be an HTMLJspTag", node[2] instanceof JspTag);
    JspTag tag2 = (JspTag) node[2];
    String expected = "\r\n" + "    org.apache.struts.util.BeanUtils.populate(transfer, request);\r\n"
View Full Code Here

    Tag tag = (Tag) node[0];
    assertStringEquals("alt", "Marshall Field's", tag.getAttribute("ALT"));
    assertStringEquals(
        "html",
        "<IMG BORDER=\"0\" ALT=\"Marshall Field's\" WIDTH=\"87\" SRC=\"http://g-images.amazon.com/images/G/01/merchants/logos/marshall-fields-logo-20.gif\" HEIGHT=\"20\">",
        tag.toHtml());
  }

  public void testEmptyTag() throws Exception {
    createParser("<custom/>");
    parseAndAssertNodeCount(1);
View Full Code Here

    parseAndAssertNodeCount(1);
    assertType("should be Tag", Tag.class, node[0]);
    Tag tag = (Tag) node[0];
    assertStringEquals("tag name", "CUSTOM", tag.getTagName());
    assertTrue("empty tag", tag.isEmptyXmlTag());
    assertStringEquals("html", "<CUSTOM/>", tag.toHtml());
  }

  public void testTagWithCloseTagSymbolInAttribute() throws ParserException {
    createParser("<tag att=\"a>b\">");
    parseAndAssertNodeCount(1);
View Full Code Here

  public void testTagWithSingleQuote() throws ParserException {
    createParser("<tag att=\'a<b\'>");
    parseAndAssertNodeCount(1);
    assertType("should be Tag", Tag.class, node[0]);
    Tag tag = (Tag) node[0];
    assertStringEquals("html", "<TAG ATT=\"a<b\">", tag.toHtml());
    assertStringEquals("attribute", "a<b", tag.getAttribute("att"));
  }

  /**
   * The following multi line test cases are from bug #725749 Parser does not
View Full Code Here

  public void testMultiLine1() throws ParserException {
    createParser("<meta name=\"foo\" content=\"foo<bar>\">");
    parseAndAssertNodeCount(1);
    assertType("should be Tag", Tag.class, node[0]);
    Tag tag = (Tag) node[0];
    String html = tag.toHtml();
    assertStringEquals("html", "<META CONTENT=\"foo<bar>\" NAME=\"foo\">", html);
    String attribute1 = tag.getAttribute("NAME");
    assertStringEquals("attribute 1", "foo", attribute1);
    String attribute2 = tag.getAttribute("CONTENT");
    assertStringEquals("attribute 2", "foo<bar>", attribute2);
View Full Code Here

  public void testMultiLine2() throws ParserException {
    createParser("<meta name=\"foo\" content=\"foo<bar\">");
    parseAndAssertNodeCount(1);
    assertType("should be Tag", Tag.class, node[0]);
    Tag tag = (Tag) node[0];
    String html = tag.toHtml();
    assertStringEquals("html", "<META CONTENT=\"foo<bar\" NAME=\"foo\">", html);
    String attribute1 = tag.getAttribute("NAME");
    assertStringEquals("attribute 1", "foo", attribute1);
    String attribute2 = tag.getAttribute("CONTENT");
    assertStringEquals("attribute 2", "foo<bar", attribute2);
View Full Code Here

  public void testMultiLine3() throws ParserException {
    createParser("<meta name=\"foo\" content=\"foobar>\">");
    parseAndAssertNodeCount(1);
    assertType("should be Tag", Tag.class, node[0]);
    Tag tag = (Tag) node[0];
    String html = tag.toHtml();
    assertStringEquals("html", "<META CONTENT=\"foobar>\" NAME=\"foo\">", html);
    String attribute1 = tag.getAttribute("NAME");
    assertStringEquals("attribute 1", "foo", attribute1);
    String attribute2 = tag.getAttribute("CONTENT");
    assertStringEquals("attribute 2", "foobar>", attribute2);
View Full Code Here

  public void testMultiLine4() throws ParserException {
    createParser("<meta name=\"foo\" content=\"foo\nbar>\">");
    parseAndAssertNodeCount(1);
    assertType("should be Tag", Tag.class, node[0]);
    Tag tag = (Tag) node[0];
    String html = tag.toHtml();
    assertStringEquals("html", "<META CONTENT=\"foo\r\nbar>\" NAME=\"foo\">", html);
    String attribute1 = tag.getAttribute("NAME");
    assertStringEquals("attribute 1", "foo", attribute1);
    String attribute2 = tag.getAttribute("CONTENT");
    assertStringEquals("attribute 2", "foo\r\nbar>", attribute2);
View Full Code Here

    createParser("<meta name=\"foo\" content=\"<foo>\nbar\">");
    if (1.4 <= Parser.getVersionNumber()) {
      parseAndAssertNodeCount(1);
      assertType("should be Tag", Tag.class, node[0]);
      Tag tag = (Tag) node[0];
      String html = tag.toHtml();
      assertStringEquals("html", "<META CONTENT=\"<foo>\r\nbar\" NAME=\"foo\">", html);
      String attribute1 = tag.getAttribute("NAME");
      assertStringEquals("attribute 1", "foo", attribute1);
      String attribute2 = tag.getAttribute("CONTENT");
      assertStringEquals("attribute 2", "<foo>\r\nbar", attribute2);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.