Package org.htmlparser.tags

Examples of org.htmlparser.tags.LinkTag


        String testHTML = "<a\thref=\"http://cbc.ca\">";
        createParser(testHTML);
        parser.registerScanners();
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a LinkTag", node[0] instanceof LinkTag);
        LinkTag tag = (LinkTag) node[0];
        String href = tag.getAttribute("HREF");
        assertStringEquals("Resolved Link", "http://cbc.ca", href);
    }
View Full Code Here


            javascriptLink = true;
        }
        String accessKey = getAccessKey(compositeTagData.getStartTag());
        String myLinkText = compositeTagData.getChildren().toString();

        LinkTag linkTag =
            new LinkTag(
                tagData,
                compositeTagData,
                new LinkData(
                    link,
                    myLinkText,
                    accessKey,
                    mailLink,
                    javascriptLink));
        linkTag.setThisScanner(this);
        return linkTag;
    }
View Full Code Here

        parser.addScanner(new LinkScanner("-l"));

        parseAndAssertNodeCount(1);
        // The node should be an HTMLLinkTag
        assertTrue("Node should be a HTMLLinkTag", 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

        parser.addScanner(new LinkScanner("-l"));

        parseAndAssertNodeCount(1);
        // The node should be an HTMLLinkTag
        assertTrue("Node should be a HTMLLinkTag", 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

        parser.addScanner(new LinkScanner("-l"));

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

        parser.addScanner(new LinkScanner("-l"));

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

        parser.addScanner(new LinkScanner("-l"));

        parseAndAssertNodeCount(6);
        // The node should be an LinkTag
        assertTrue("Node should be a LinkTag", node[0] instanceof LinkTag);
        LinkTag linkNode = (LinkTag) node[2];
        assertStringEquals(
            "Link incorrect!!",
            "http://photo.kimo.com.tw",
            linkNode.getLink());
        assertEquals(
            "Link beginning",
            new Integer(48),
            new Integer(linkNode.elementBegin()));
        assertEquals(
            "Link ending",
            new Integer(38),
            new Integer(linkNode.elementEnd()));

        LinkTag linkNode2 = (LinkTag) node[4];
        assertStringEquals(
            "Link incorrect!!",
            "http://address.kimo.com.tw",
            linkNode2.getLink());
        assertEquals(
            "Link beginning",
            new Integer(46),
            new Integer(linkNode2.elementBegin()));
        assertEquals(
            "Link ending",
            new Integer(42),
            new Integer(linkNode2.elementEnd()));
    }
View Full Code Here

        // Register the image scanner
        parser.addScanner(new LinkScanner("-l"));

        parseAndAssertNodeCount(1);
        assertTrue("Node should be a HTMLLinkTag", 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

        // Register the image scanner
        parser.addScanner(new LinkScanner("-l"));

        parseAndAssertNodeCount(1);
        assertTrue("Node should be a HTMLLinkTag", node[0] instanceof LinkTag);
        LinkTag linkNode = (LinkTag) node[0];
        assertEquals(
            "Link incorrect",
            "http://www.cj.com/abcd.html",
            linkNode.getLink());
    }
View Full Code Here

        parser.addScanner(new LinkScanner("-l"));

        parseAndAssertNodeCount(1);
        // The node should be an HTMLLinkTag
        assertTrue("Node should be a HTMLLinkTag", 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.