Package org.htmlparser.tags

Examples of org.htmlparser.tags.LinkTag


        String rawhref = "\"" + href + "\"";
        String html = "<a id=" + rawid + /* no space */ "class=" + rawcls + " href=" + rawhref + ">Pick me.</a>";
        createParser (html);
        parseAndAssertNodeCount (1);
        assertTrue ("Node should be an LinkTag", node[0] instanceof LinkTag);
        LinkTag link = (LinkTag)node[0];
        Vector attributes = link.getAttributesEx ();
        assertEquals ("Incorrect number of attributes", 6, attributes.size ());
        assertStringEquals ("id wrong", rawid, link.getAttributeEx ("id").getRawValue ());
        assertStringEquals ("class wrong", rawcls, link.getAttributeEx ("class").getRawValue ());
        assertStringEquals ("href wrong", rawhref, link.getAttributeEx ("href").getRawValue ());
        assertStringEquals ("id wrong", id, link.getAttributeEx ("id").getValue ());
        assertStringEquals ("class wrong", cls, link.getAttributeEx ("class").getValue ());
        assertStringEquals ("href wrong", href, link.getAttributeEx ("href").getValue ());
    }
View Full Code Here


    {
        createParser("<A HREF=\"../test.html\">abcd</A>","http://www.google.com/test/index.html");
        parseAndAssertNodeCount(1);
        // The node should be an LinkTag
        assertTrue("Node should be a LinkTag",node[0] instanceof LinkTag);
        LinkTag linkNode = (LinkTag)node[0];
        assertEquals("The image locn","http://www.google.com/test.html",linkNode.getLink());
    }
View Full Code Here

    {
        createParser("<A HREF=\"../../test.html\">abcd</A>","http://www.google.com/test/test/index.html");
        parseAndAssertNodeCount(1);
        // The node should be an LinkTag
        assertTrue("Node should be a LinkTag",node[0] instanceof LinkTag);
        LinkTag linkNode = (LinkTag)node[0];
        assertEquals("The image locn","http://www.google.com/test.html",linkNode.getLink());
    }
View Full Code Here

    {
        createParser("<A HREF=\"/mylink.html\">abcd</A>","http://www.cj.com/");
        parseAndAssertNodeCount(1);
        // The node should be an LinkTag
        assertTrue("Node should be a LinkTag",node[0] instanceof LinkTag);
        LinkTag linkNode = (LinkTag)node[0];
        assertEquals("Link incorrect","http://www.cj.com/mylink.html",linkNode.getLink());
    }
View Full Code Here

    {
        createParser("<A HREF=\"/mylink.html\">abcd</A>","http://www.cj.com");
        parseAndAssertNodeCount(1);
        // The node should be an LinkTag
        assertTrue("Node should be a LinkTag",node[0] instanceof LinkTag);
        LinkTag linkNode = (LinkTag)node[0];
        assertEquals("Link incorrect!!","http://www.cj.com/mylink.html",linkNode.getLink());
    }
View Full Code Here

        createParser("<a href=" + link1 + ">���O</a>&nbsp; <a \n"+
        "href=" + link2 + ">��ï</a>&nbsp; <a\n"+
        "href=" + link3 + ">�q�T��</a>&nbsp;&nbsp;","http://www.cj.com");
        parseAndAssertNodeCount(6);
        assertTrue("Node should be a LinkTag",node[2] instanceof LinkTag);
        LinkTag linkNode = (LinkTag)node[2];
        assertStringEquals("Link incorrect!!",link2,linkNode.getLink());
        assertTrue("Node should be a LinkTag",node[4] instanceof LinkTag);
        LinkTag linkNode2 = (LinkTag)node[4];
        assertStringEquals("Link incorrect!!",link3,linkNode2.getLink());
    }
View Full Code Here

        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

    public void testLinkNodeMailtoBug() throws ParserException
    {
        createParser("<A HREF='mailto:somik@yahoo.com'>hello</A>","http://www.cj.com/");
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a LinkTag",node[0] instanceof LinkTag);
        LinkTag linkNode = (LinkTag)node[0];
        assertStringEquals("Link incorrect","somik@yahoo.com",linkNode.getLink());
        assertEquals("Link Type",new Boolean(true),new Boolean(linkNode.isMailLink()));
    }
View Full Code Here

    public void testLinkNodeSingleQuoteBug() throws ParserException
    {
        createParser("<A HREF='abcd.html'>hello</A>","http://www.cj.com/");
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a LinkTag",node[0] instanceof LinkTag);
        LinkTag linkNode = (LinkTag)node[0];
        assertEquals("Link incorrect","http://www.cj.com/abcd.html",linkNode.getLink());
    }
View Full Code Here

    {
        createParser("<A HREF=\"test.html\">abcd</A>","http://www.google.com/test/index.html");
        parseAndAssertNodeCount(1);
        // The node should be an LinkTag
        assertTrue("Node should be a LinkTag",node[0] instanceof LinkTag);
        LinkTag LinkTag = (LinkTag)node[0];
        assertEquals("The image locn","http://www.google.com/test/test.html",LinkTag.getLink());
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.LinkTag

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.