Package org.htmlparser

Examples of org.htmlparser.Tag.toHtml()


        Tag tag = (Tag)node[0];
        assertStringEquals("toHTML()",tag1,tag.toHtml());
        assertTrue("3rd Node should be a Tag",node[2] instanceof Tag);
        assertTrue("5th Node should be a Tag",node[6] instanceof Tag);
        tag = (Tag)node[2];
        assertEquals("Raw String of the tag","<TITLE>",tag.toHtml());
        tag = (Tag)node[6];
        assertEquals("Raw String of the tag","<A HREF=\"Hello.html\">",tag.toHtml());
    }

View Full Code Here


        assertTrue("3rd Node should be a Tag",node[2] instanceof Tag);
        assertTrue("5th Node should be a Tag",node[6] instanceof Tag);
        tag = (Tag)node[2];
        assertEquals("Raw String of the tag","<TITLE>",tag.toHtml());
        tag = (Tag)node[6];
        assertEquals("Raw String of the tag","<A HREF=\"Hello.html\">",tag.toHtml());
    }


    /**
     * Test parseParameter method
View Full Code Here

        createParser(testHTML);
        parser.setNodeFactory (new PrototypicalNodeFactory (true));
        parseAndAssertNodeCount(2);
        assertTrue("First node should be an HTMLtag",node[0] instanceof Tag);
        Tag htmlTag = (Tag)node[0];
        assertStringEquals("Expected HTML",expectedHTML,htmlTag.toHtml());
    }

    public void testIgnoreState() throws ParserException
    {
        String testHTML = "<A \n"+
View Full Code Here

        // the node should be a Tag
        assertTrue("Node should be a Tag",node[0] instanceof Tag);
        Tag tag = (Tag)node[0];
        assertEquals("Initial text should be","TABLE BORDER=0",tag.getText ());
        tag.setAttribute ("BORDER","\"1\"");
        assertEquals("HTML should be","<TABLE BORDER=\"1\">", tag.toHtml ());
    }
}
View Full Code Here

        Tag tag = (Tag)node[0];
        assertStringEquals("alt","Marshall Field's",tag.getAttribute("ALT"));
        assertStringEquals(
            "html",
            testHtml,
            tag.toHtml()
        );
    }

    public void testEmptyTag() throws Exception
    {
View Full Code Here

        assertStringEquals("tag name","CUSTOM",tag.getTagName());
        assertTrue("empty tag",tag.isEmptyXmlTag());
        assertStringEquals(
            "html",
            html,
            tag.toHtml()
        );
    }

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

        parseAndAssertNodeCount(2);
        // The node should be a tag
        assertTrue("Node should be a Tag",node[1] instanceof Tag);
        Tag endTag = (Tag)node[1];
        assertTrue("Node should be an end Tag",endTag.isEndTag ());
        assertEquals("Raw String","</HTML>",endTag.toHtml());
    }

    public void testEndTagFind() throws ParserException {
        String testHtml =
            "<SCRIPT>document.write(d+\".com\")</SCRIPT><BR>";
View Full Code Here

        if (node instanceof Tag) {
          Tag tag = (Tag)node;
          if (tag.getTagName().equalsIgnoreCase("A") && !tag.isEndTag()) {
            assertEquals("href", "http://example.com/api?a=1&amp;b=2&c=3&#34;", tag.getAttribute("HREF"));

            String htmlout = tag.toHtml();
            assertEquals("toHtml output", "<a href=\"http://example.com/api?a=1&amp;b=2&c=3&#34;\">", htmlout);
          }
        }
      }
    }
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.