Package org.htmlparser.tags

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


        assertTrue("1st Node should be a Tag", node[0] instanceof Tag);
        Tag tag = (Tag) node[0];
        assertStringEquals(
            "toHTML()",
            "<MYTAG EFGH=\"\" ABCD=\"\" MNOP=\"\" IJKL=\"\">",
            tag.toHtml());
        assertTrue("2nd Node should be a Tag", node[1] instanceof Tag);
        assertTrue("5th Node should be a Tag", node[4] instanceof Tag);
        tag = (Tag) node[1];
        assertEquals("Raw String of the tag", "<TITLE>", tag.toHtml());
        tag = (Tag) node[4];
View Full Code Here


            "<MYTAG EFGH=\"\" ABCD=\"\" MNOP=\"\" IJKL=\"\">",
            tag.toHtml());
        assertTrue("2nd Node should be a Tag", node[1] instanceof Tag);
        assertTrue("5th Node should be a Tag", node[4] instanceof Tag);
        tag = (Tag) node[1];
        assertEquals("Raw String of the tag", "<TITLE>", tag.toHtml());
        tag = (Tag) node[4];
        assertEquals(
            "Raw String of the tag",
            "<A HREF=\"Hello.html\">",
            tag.toHtml());
View Full Code Here

        assertEquals("Raw String of the tag", "<TITLE>", tag.toHtml());
        tag = (Tag) node[4];
        assertEquals(
            "Raw String of the tag",
            "<A HREF=\"Hello.html\">",
            tag.toHtml());
    }

    /**
     * Test parseParameter method
     * Created by Kaarle Kaila (22 Oct 2001)
View Full Code Here

        createParser(testHTML);
        parseAndAssertNodeCount(2);
        assertTrue("First node should be an HTMLtag", node[0] instanceof Tag);
        Tag htmlTag = (Tag) node[0];
        String expectedHTML = "<TEXTAREA NAME=\"JohnDoe\">";
        assertStringEquals("Expected HTML", expectedHTML, htmlTag.toHtml());
    }
    public void testIgnoreState() throws ParserException
    {
        String testHTML =
            "<A \n"
View Full Code Here

        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

        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/>");
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\">");
View Full Code Here

    {
        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
View Full Code Here

    {
        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");
View Full Code Here

    {
        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");
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.