Examples of LinkTag


Examples of org.htmlparser.tags.LinkTag

                if (ATT_IS_IMAGE.equalsIgnoreCase(tag.getAttribute(ATT_TYPE))) {
                    // then we need to download the binary
                    binUrlStr = tag.getAttribute(ATT_SRC);
                }
            } else if (tag instanceof LinkTag) {
                LinkTag link = (LinkTag) tag;
                if (link.getChild(0) instanceof ImageTag) {
                    ImageTag img = (ImageTag) link.getChild(0);
                    binUrlStr = img.getImageURL();
                }
            } else if (tag instanceof ScriptTag) {
                binUrlStr = tag.getAttribute(ATT_SRC);
                // Bug 51750
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

                    {
                        // then we need to download the binary
                        binUrlStr= input.getAttribute("src");
                    }
        } else if (node instanceof LinkTag){
          LinkTag link = (LinkTag)node;
          if (link.getChild(0) instanceof ImageTag){
            ImageTag img = (ImageTag)link.getChild(0);
            binUrlStr = img.getImageURL();
          }
        } else if (node instanceof ScriptTag){
          ScriptTag script = (ScriptTag)node;
          binUrlStr = script.getAttribute("src");
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

            "<a href=\"/cataclysm/Langy-AnEmpireReborn-Ch2.shtml#story\""
                + "><< An Empire Reborn: Chapter 2 <<</a>");
        parser.registerScanners();
        parseAndAssertNodeCount(1);
        assertType("node", LinkTag.class, node[0]);
        LinkTag linkTag = (LinkTag) node[0];
        assertEquals(
            "link text",
            "<< An Empire Reborn: Chapter 2 <<",
            linkTag.getLinkText());
    }
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

    {
        createParser("<a href=\"http://www.kizna.com/servlets/SomeServlet?name=Sam Joseph\" accessKey=1>Click Here</A>");
        parser.addScanner(new LinkScanner("-l"));
        parseAndAssertNodeCount(1);
        assertTrue("The node should be a link tag", node[0] instanceof LinkTag);
        LinkTag linkTag = (LinkTag) node[0];
        assertEquals(
            "Link URL of link tag",
            "http://www.kizna.com/servlets/SomeServlet?name=Sam Joseph",
            linkTag.getLink());
        assertEquals(
            "Link Text of link tag",
            "Click Here",
            linkTag.getLinkText());
        assertEquals("Access key", "1", linkTag.getAccessKey());
    }
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

            "http://www.yahoo.com");
        parser.registerScanners();
        Node linkNodes[] = parser.extractAllNodesThatAre(LinkTag.class);

        assertEquals("number of links", 2, linkNodes.length);
        LinkTag linkTag = (LinkTag) linkNodes[0];
        assertStringEquals(
            "Link",
            "http://www.yahoo.com/s/8741",
            linkTag.getLink());
        // Verify the link data
        assertStringEquals("Link Text", "", linkTag.getLinkText());
        // Verify the reconstruction html
        assertStringEquals(
            "toHTML",
            "<A HREF=\"s/8741\"><IMG BORDER=\"0\" WIDTH=\"16\" SRC=\"http://us.i1.yimg.com/us.yimg.com/i/i16/mov_popc.gif\" HEIGHT=\"16\"></A>",
            linkTag.toHtml());
    }
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

            node[0] instanceof LinkTag);
        // The second node should be a HTMLStringNode
        assertTrue(
            "Second node should be a HTMLLinkTag",
            node[1] instanceof LinkTag);
        LinkTag linkTag = (LinkTag) node[0];
        assertEquals("Link", "http://www.yahoo.com/s/8741", linkTag.getLink());
        // Verify the link data
        assertEquals("Link Text", "This is a test\r\n", linkTag.getLinkText());
        // Verify the reconstruction html
        assertStringEquals(
            "toHTML()",
            "<A HREF=\"s/8741\"><IMG BORDER=\"0\" WIDTH=\"16\" SRC=\"http://us.i1.yimg.com/us.yimg.com/i/i16/mov_popc.gif\" HEIGHT=\"16\">This is a test\r\n</A>",
            linkTag.toHtml());
    }
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

    {
        createParser("<a href=\"http://cbc.ca/artsCanada/stories/greatnorth271202\" class=\"lgblacku\">Vancouver schools plan 'Great Northern Way'</a>");
        parser.addScanner(new LinkScanner("-l"));
        parseAndAssertNodeCount(1);
        assertTrue("The node should be a link tag", node[0] instanceof LinkTag);
        LinkTag linkTag = (LinkTag) node[0];
        assertStringEquals(
            "Extracted Text",
            "Vancouver schools plan 'Great Northern Way'",
            linkTag.getLinkText());
    }
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

    {
        createParser("<a href=\"http://www.kizna.com/servlets/SomeServlet?name=Sam Joseph\">Click Here</A>");
        parser.addScanner(new LinkScanner("-l"));
        parseAndAssertNodeCount(1);
        assertTrue("The node should be a link tag", node[0] instanceof LinkTag);
        LinkTag linkTag = (LinkTag) node[0];
        assertEquals(
            "Link URL of link tag",
            "http://www.kizna.com/servlets/SomeServlet?name=Sam Joseph",
            linkTag.getLink());
        assertEquals(
            "Link Text of link tag",
            "Click Here",
            linkTag.getLinkText());
    }
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

        parser.addScanner(new LinkScanner("-l"));
        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());
        assertStringEquals("Link URL of link tag", exp, linkTag.getLink());
        assertEquals(
            "Link Text of link tag",
            " Journalism 3.0",
            linkTag.getLinkText());
        assertTrue(
            "Eight node should be a string node",
            node[7] instanceof StringNode);
        StringNode stringNode = (StringNode) node[7];
        assertEquals(
View Full Code Here

Examples of org.htmlparser.tags.LinkTag

        parser.addScanner(new LinkScanner("-l"));
        parseAndAssertNodeCount(1);
        assertTrue(
            "Node identified should be HTMLLinkTag",
            node[0] instanceof LinkTag);
        LinkTag linkTag = (LinkTag) node[0];
        assertEquals(
            "Expected Link",
            "http://www.yahoo.com/mytest.html",
            linkTag.getLink());
    }
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.