Package org.htmlparser.tags

Examples of org.htmlparser.tags.ImageTag


    {
        createParser("<IMG alt=Google height=115 src=\"../../goo/title_homepage4.gif\" width=305>","http://www.google.com/test/test/index.html");
        parseAndAssertNodeCount(1);
        // The node should be an HTMLImageTag
        assertTrue("Node should be a HTMLImageTag",node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag)node[0];
        assertEquals("The image locn","http://www.google.com/goo/title_homepage4.gif",imageTag.getImageURL());
    }
View Full Code Here


    public void testImageTagSingleQuoteBug() throws ParserException
    {
        createParser("<IMG SRC='abcd.jpg'>","http://www.cj.com/");
        parseAndAssertNodeCount(1);
        assertTrue("Node should be a HTMLImageTag",node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag)node[0];
        assertEquals("Image incorrect","http://www.cj.com/abcd.jpg",imageTag.getImageURL());
    }
View Full Code Here

    {
        createParser("<IMG SRC=>","http://www.google.com/test/index.html");
        parseAndAssertNodeCount(1);
        // The node should be an HTMLLinkTag
        assertTrue("Node should be a HTMLImageTag",node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag)node[0];
        assertStringEquals("The image location","",imageTag.getImageURL());
    }
View Full Code Here

        String img = "<IMG alt=Google height=115 src=\"../../goo/title_homepage4.gif\" width=305>";
        createParser(img,"http://www.google.com/test/test/index.html");
        parseAndAssertNodeCount(1);
        // The node should be an ImageTag
        assertTrue("Node should be a ImageTag",node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag)node[0];
        assertStringEquals("toHtml",img,imageTag.toHtml());
        assertEquals("Alt","Google",imageTag.getAttribute("alt"));
        assertEquals("Height","115",imageTag.getAttribute("height"));
        assertEquals("Width","305",imageTag.getAttribute("width"));
    }
View Full Code Here

            + "</a>";
        createParser (html);
        parseAndAssertNodeCount (1);
        assertTrue ("Node should be a LinkTag", node[0] instanceof LinkTag);
        LinkTag link = (LinkTag)node[0];
        ImageTag img = extractLinkImage (link);
        assertNotNull ("no image tag", img);
    }
View Full Code Here

            + "src=\"http://i.cnn.net/cnn/images/1.gif\"/>";

        createParser (html);
        parseAndAssertNodeCount (1);
        assertTrue ("Node should be an ImageTag", node[0] instanceof ImageTag);
        ImageTag img = (ImageTag)node[0];
        assertTrue ("bad source", "http://i.cnn.net/cnn/images/1.gif".equals (img.getImageURL ()));
    }
View Full Code Here

    public void testDynamicRelativeImageScan() throws ParserException {
        createParser("<IMG SRC=\"../abc/def/mypic.jpg\">","http://www.yahoo.com/ghi?abcdefg");
        parseAndAssertNodeCount(1);
        assertTrue("Node identified should be HTMLImageTag",node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag)node[0];
        assertEquals("Expected Link","http://www.yahoo.com/abc/def/mypic.jpg",imageTag.getImageURL());
    }
View Full Code Here

    {
        String locn = "http://us.a1.yimg.com/us.yimg.com/i/ww/m5v5.gif";
        createParser ("<img width=638 height=53 border=0 usemap=\"#m\" src=" + locn + " alt=Yahoo>");
        parseAndAssertNodeCount(1);
        assertTrue("Node identified should be HTMLImageTag",node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag)node[0];
        assertEquals("Expected Image Locn",locn,imageTag.getImageURL());
    }
View Full Code Here

     */
    public void testPlaceHolderImageScan() throws ParserException {
        createParser("<IMG width=1 height=1 alt=\"a\">","http://www.yahoo.com/ghi?abcdefg");
        parseAndAssertNodeCount(1);
        assertTrue("Node identified should be HTMLImageTag",node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag)node[0];
        assertEquals("Expected Image Locn","",imageTag.getImageURL());
        assertEquals("Image width","1",imageTag.getAttribute("WIDTH"));
        assertEquals("Image height","1",imageTag.getAttribute("HEIGHT"));
        assertEquals("alt","a",imageTag.getAttribute("ALT"));
    }
View Full Code Here

    public void testRelativeImageScan() throws ParserException {
        createParser("<IMG SRC=\"mypic.jpg\">","http://www.yahoo.com");
        parseAndAssertNodeCount(1);
        assertTrue("Node identified should be ImageTag",node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag)node[0];
        assertEquals("Expected Link","http://www.yahoo.com/mypic.jpg",imageTag.getImageURL());
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.ImageTag

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.