Package org.htmlparser.tags

Examples of org.htmlparser.tags.ImageTag


        parser.registerScanners();
        parseAndAssertNodeCount(1);
        assertTrue(
            "Node identified should be HTMLImageTag",
            node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag) node[0];
        assertEquals(
            "Image Location",
            "http://www.cybergeo.presse.fr/images/lines/li065.jpg",
            imageTag.getImageURL());

    }
View Full Code Here


        parser.registerScanners();
        parseAndAssertNodeCount(1);
        assertTrue(
            "Node identified should be HTMLImageTag",
            node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag) node[0];
        assertStringEquals(
            "Image Location",
            "http://www.htmlparser.org/images/spacer.gif",
            imageTag.getImageURL());
        assertEquals("Width", "1", imageTag.getAttribute("WIDTH"));
        assertEquals("Height", "1", imageTag.getAttribute("HEIGHT"));
        assertEquals("Alt", "", imageTag.getAttribute("ALT"));
    }
View Full Code Here

        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/test/goo/title_homepage4.gif",
            imageTag.getImageURL());
    }
View Full Code Here

        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

        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

        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

        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

        parseAndAssertNodeCount(1);
        // The node should be an HTMLImageTag
        assertTrue(
            "Node should be a HTMLImageTag",
            node[0] instanceof ImageTag);
        ImageTag imageTag = (ImageTag) node[0];
        assertStringEquals(
            "The image locn",
            "<IMG WIDTH=\"305\" ALT=\"Google\" SRC=\"../../goo/title_homepage4.gif\" HEIGHT=\"115\">",
            imageTag.toHtml());
        assertEquals("Alt", "Google", imageTag.getAttribute("alt"));
        assertEquals("Height", "115", imageTag.getAttribute("height"));
        assertEquals("Width", "305", imageTag.getAttribute("width"));
    }
View Full Code Here

                    }
                } catch (MalformedURLException e1) {
                    throw new HTMLParseException(e1);
                }
            } else if (tag instanceof ImageTag) {
                ImageTag image = (ImageTag) tag;
                binUrlStr = image.getImageURL();
            } else if (tag instanceof AppletTag) {
                // look for applets

                // This will only work with an Applet .class file.
                // Ideally, this should be upgraded to work with Objects (IE)
View Full Code Here

                    }
                } catch (MalformedURLException e1) {
                    throw new HTMLParseException(e1);
                }
            } else if (tag instanceof ImageTag) {
                ImageTag image = (ImageTag) tag;
                binUrlStr = image.getImageURL();
            } else if (tag instanceof AppletTag) {
            // look for applets

            // This will only work with an Applet .class file.
            // Ideally, this should be upgraded to work with Objects (IE)
            // and archives (.jar and .zip) files as well.
                AppletTag applet = (AppletTag) tag;
                binUrlStr = applet.getAppletClass();
            } else if (tag instanceof InputTag) {
                // we check the input tag type for image
                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);
            } else if (tag instanceof FrameTag) {
                binUrlStr = tag.getAttribute(ATT_SRC);
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.