Using a LinkBean to Extract Links

A LinkBean is a pretty easy way to get just the links:

    import java.net.URL;
    import org.htmlparser.beans.LinkBean;

    public class LinkDemo
    {
        public static void main (String[] args)
        {
            LinkBean lb = new LinkBean ();
            lb.setURL ("http://urlIWantToParse.com");
            URL[] urls = lb.getLinks ();
            for (int i = 0; i < urls.length; i++)
                System.out.println (urls[i]);
        }
    }

    Last edited on Wednesday, January  7, 2004  4:10:21 pm.