Results 1 to 4 of 4
  1. #1
    atia akram is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default how to get links in html file

    sir...i need your help.you had posted a code to get links from file,but at the bottom of code you instructed to pass html file.BUT sir i am reading a link online through the given code and through that link ,i have to get child links .i think your code will help me but what changes i have to made to get my goal..
    my goal::::to get links of all child nodes from given link(e.g www .yahoo.com) and download all child links
    please help me

    Java Code:
    //////////////////////read link online/////////////////////////////////
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.URL;
    /**
     *
     * 
     */
    import java.net.MalformedURLException;
    import java.net.URL;
    public class Main {
    String thisLine;
        URL u;
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args)throws Exception {
        URL yahoo = new URL("http://www.yahoo.com/");
        BufferedReader in = new BufferedReader(new InputStreamReader(yahoo
            .openStream()));
    
        String inputLine;
    
        while ((inputLine = in.readLine()) != null)
          System.out.println(inputLine); 
       
    
        in.close();
      }
    
    }
    Last edited by Norm; 10-31-2012 at 05:43 PM. Reason: Added code tags & Moved to own thread

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default Re: help me..how to get links in html file

    get links of all child nodes from given link
    if you make a method that gets all the links from an HTML page at a URL address, you could call that method repeatedly for each new link it finds.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default Re: how to get links in html file

    You should use this thread and not continue posting on this very old thread:
    help me..how to get links in html file
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    DrummondAW is offline Member
    Join Date
    Oct 2012
    Posts
    13
    Rep Power
    0

    Default Re: how to get links in html file

    Using regular expressions would probably be the most efficient way. Here's the documentation: Lesson: Regular Expressions (The Java™ Tutorials > Essential Classes)

Similar Threads

  1. help me..how to get links in html file
    By thangbomlennet in forum New To Java
    Replies: 13
    Last Post: 11-03-2012, 05:31 PM
  2. Display Folder and contents as HTML links
    By JPR in forum New To Java
    Replies: 3
    Last Post: 01-06-2012, 09:45 PM
  3. Replies: 1
    Last Post: 12-19-2010, 04:46 AM
  4. HTML Links on IzPack HTMLInfoPanel not working correctly
    By salman.kagzi in forum New To Java
    Replies: 0
    Last Post: 11-30-2010, 05:07 PM
  5. How find Links in a HTML Page
    By binumathew in forum Networking
    Replies: 6
    Last Post: 08-03-2010, 06:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •