Package org.htmlparser

Examples of org.htmlparser.PrototypicalNodeFactory


        createParser("<FORM action=http://search.yahoo.com/bin/search name=f><MAP name=m><AREA\n"+
            "coords=0,0,52,52 href=\"http://www.yahoo.com/r/c1\" shape=RECT><AREA"+
            "coords=53,0,121,52 href=\"http://www.yahoo.com/r/p1\" shape=RECT><AREA"+
            "coords=122,0,191,52 href=\"http://www.yahoo.com/r/m1\" shape=RECT><AREA"+
            "coords=441,0,510,52 href=\"http://www.yahoo.com/r/wn\" shape=RECT>","http://www.cj.com/");
        parser.setNodeFactory (new PrototypicalNodeFactory (new LinkTag ()));
        parseAndAssertNodeCount(6);
    }
View Full Code Here


            "href=\"http://ads.samachar.com/bin/redirect/tech.txt?http://www.samachar.com/tech\n"+
            "nical.html\"> Journalism 3.0</a>";
        createParser(link1 + "\n"+
            "<LI><font color=\"FF0000\" size=-1><b>Tech Samachar:</b></font>" +
            link2 + " by Rajesh Jain","http://www.cj.com/");
        parser.setNodeFactory (new PrototypicalNodeFactory (new LinkTag ()));
        parseAndAssertNodeCount(10);
        assertTrue("First Node should be a LinkTag",node[0] instanceof LinkTag);
        LinkTag linkTag = (LinkTag)node[0];
        assertStringEquals("Link Raw Text",link1,linkTag.toHtml());
        assertTrue("Ninth Node should be a LinkTag",node[8] instanceof LinkTag);
View Full Code Here

     */
    public void testMultipleLineBug() throws ParserException {
        createParser("<LI><font color=\"FF0000\" size=-1><b>Tech Samachar:</b></font><a \n"+
        "href=\"http://ads.samachar.com/bin/redirect/tech.txt?http://www.samachar.com/tech\n"+
        "nical.html\"> Journalism 3.0</a> by Rajesh Jain");
        parser.setNodeFactory (new PrototypicalNodeFactory (new LinkTag ()));
        parseAndAssertNodeCount(8);
        assertTrue("Seventh node should be a link tag",node[6] instanceof LinkTag);
        LinkTag linkTag = (LinkTag)node[6];
        String exp = new String("http://ads.samachar.com/bin/redirect/tech.txt?http://www.samachar.com/technical.html");
        //assertEquals("Length of link tag",exp.length(), linkTag.getLink().length());
View Full Code Here

     */
    public void testScan() throws ParserException
    {
        createParser("<A HREF=\"mytest.html\"><IMG SRC=\"abcd.jpg\">Hello World</A>","http://www.yahoo.com");
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[] {
                    new LinkTag (),
                    new ImageTag (),
                }));
        parseAndAssertNodeCount(1);
View Full Code Here

    }

    public void testLinkDataContents() throws ParserException {
        createParser("<a href=\"http://transfer.go.com/cgi/atransfer.pl?goto=http://www.signs.movies.com&name=114332&srvc=nws&context=283&guid=4AD5723D-C802-4310-A388-0B24E1A79689\" target=\"_new\"><img src=\"http://ad.abcnews.com/ad/sponsors/buena_vista_pictures/bvpi-ban0003.gif\" width=468 height=60 border=\"0\" alt=\"See Signs in Theaters 8-2 - Starring Mel Gibson\" align=><font face=\"verdana,arial,helvetica\" SIZE=\"1\"><b></b></font></a>","http://transfer.go.com");
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[] {
                    new LinkTag (),
                    new ImageTag (),
                }));
        parseAndAssertNodeCount(1);
View Full Code Here

        createParser(
        "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n"+
            frame1 + "\n"+
            frame2 + "\n"+
        "</frameset>");
        parser.setNodeFactory (new PrototypicalNodeFactory (new FrameTag ()));
        parseAndAssertNodeCount(7);
        assertTrue("Node 3 should be Frame Tag",node[2] instanceof FrameTag);
        assertTrue("Node 5 should be Frame Tag",node[4] instanceof FrameTag);

        FrameTag frameTag1 = (FrameTag)node[2];
View Full Code Here

        "<frameset rows=\"115,*\" frameborder=\"NO\" border=\"0\" framespacing=\"0\">\n"+
            "<frame name=\"topFrame\" noresize src=\"demo_bc_top.html\" scrolling=\"NO\" frameborder=\"NO\">\n"+
            "<frame name=\"mainFrame\" src=\"http://www.kizna.com/web_e/\" scrolling=\"AUTO\">\n"+
        "</frameset>","http://www.google.com/test/index.html");

        parser.setNodeFactory (new PrototypicalNodeFactory (new FrameTag ()));
        parseAndAssertNodeCount(7);

        assertTrue("Node 2 should be Frame Tag",node[2] instanceof FrameTag);
        assertTrue("Node 4 should be Frame Tag",node[4] instanceof FrameTag);

View Full Code Here

        tag + "\n"+
        "<META name=\"keywords\" content=\"SpamCop spam cop email filter abuse header headers parse parser utility script net net-abuse filter mail program system trace traceroute dns\">\n"+
        "<META name=\"language\" content=\"en\">\n"+
        "<META name=\"owner\" content=\"service@admin.spamcop.net\">\n"+
        "<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=ISO-8859-1\">");
        parser.setNodeFactory (new PrototypicalNodeFactory (new MetaTag ()));
        parseAndAssertNodeCount(18);
        assertTrue("Node 8 should be End Tag",node[7] instanceof Tag && ((Tag)node[7]).isEndTag ());
        assertTrue("Node 10 should be META Tag",node[9] instanceof MetaTag);
        MetaTag metaTag;
        metaTag = (MetaTag) node[9];
View Full Code Here

        createParser(
        "<META NAME=\"" + description + "\" CONTENT=\"" + content + "\">",
        "http://www.google.com/test/index.html"
        );
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[] {
                    new MetaTag (),
                }));
        parseAndAssertNodeCount(1);
        assertTrue("Node should be meta tag",node[0] instanceof MetaTag);
View Full Code Here

            "<meta http-equiv=\"" + equiv + "\" " +
            "content=\"" + content + "\">" +
            "</head>" +
            "</html>"
        );
        parser.setNodeFactory (new PrototypicalNodeFactory (new MetaTag ()));
        parseAndAssertNodeCount(5);
        assertType("Meta Tag expected", MetaTag.class, node[2]);
        MetaTag metaTag = (MetaTag)node[2];

        assertStringEquals("http-equiv",equiv,metaTag.getHttpEquiv());
View Full Code Here

TOP

Related Classes of org.htmlparser.PrototypicalNodeFactory

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.