Results 1 to 3 of 3
  1. #1
    fishy8158 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default reading urls from html file.

    As title. If i have a url , example "http://java.sun.com/index.html" I want to print out all the links in this url. What I already did was reading and writing all the contents to a file. I can read the file but I am stuck at how do I know it is a url when its reading. Thanks for any suggestions.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: reading urls from html file.

    I think that I understand your question. You want to get a web page, a URL, and search for all the links, i.e., that have <a> tags with an href attribute, correct? Consider using an HTML parser such as Jsoup (which I have used and really enjoy) as this was built just for this sort of exercise and can simplify your task immensely.

  3. #3
    fishy8158 is offline Member
    Join Date
    Oct 2011
    Posts
    22
    Rep Power
    0

    Default Re: reading urls from html file.

    Thanks for the reply, and you got my question correct. However, this is an assigment from professor, and i don't think im allowed to use 3rd party libraries.

Similar Threads

  1. using href for JEditorpane reading html file
    By crozarius in forum Advanced Java
    Replies: 0
    Last Post: 04-13-2011, 08:08 PM
  2. [HELP] Java with URLs/HTML
    By Nerd in forum Java Applets
    Replies: 7
    Last Post: 11-20-2010, 10:21 PM
  3. reading an Html file and checking for urls
    By sudukrish in forum Advanced Java
    Replies: 1
    Last Post: 04-25-2009, 02:39 AM
  4. Problem in reading HTML input field while uploading file
    By sudipanand in forum Java Servlet
    Replies: 1
    Last Post: 11-27-2008, 10:26 AM
  5. Reading URLs Protected with HTTP Authentication
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-07-2008, 08:58 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
  •