[Htmlparser-user] Extracting Image Info from a Link Tag
Brought to you by:
derrickoswald
From: Somik R. <so...@ya...> - 2002-03-16 10:52:44
|
Hi Gordon, This is in reply to your request for help on the sourceforge site. I = couldnt find out how to format code and put it up there. Here's the sample code for you : HTMLNode node,node2;=20 HTMLLinkTag linkTag;=20 HTMLImageTag imageTag;=20 for (Enumeration e=3D parser.elements();e.hasMoreElements();) {=20 node =3D (HTMLNode)e.nextElement();=20 if (node instanceof HTMLLinkTag) { // If its a link tag, only = then shall we look for image tags within them linkTag =3D (HTMLLinkTag)node;=20 for (Enumeration e2=3DlinkTag.linkData();e2.hasMoreElements();) { = // Go through the list of elements in this node2 =3D (HTMLNode)e2.nextElement();=20 if (node2 instanceof HTMLImageTag) { // Only if the element is = an image tag shall we downcase imageTag =3D (HTMLImageTag)node2;=20 System.out.println("Image loc = =3D"+imageTag.getImageLocation());=20 }=20 }=20 }=20 }=20 Regards, Somik |