write an IE system in java

how would i write an information extraction sytem with java?im not sure what the best way to go about it would be and  im wondering what techniques work best?the system will get the information from searched websites on the net and download it (probably stored in a database then).Would that be done using a web crawler or how?
any sample code for reference would be very handy and helpful.
shamshanaghyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bloodredsunCommented:
You need to connect to a URL then parse the HTML for links present in the page and then add the links to a list to visit.

Here's a method that gets the content of a URL as a string:

public static String getURL( final String pURL ){
            StringBuffer sb = new StringBuffer();
            try {
                  URL u = new URL( pURL );
                  HttpURLConnection huc = (HttpURLConnection) u.openConnection();
                  huc.setRequestMethod( GET );
                  huc.connect();
                  BufferedReader br = new BufferedReader(new InputStreamReader(huc.getInputStream()));

                  int b = 0;
                  while((b = br.read()) != -1) {
                        sb.append((char)b);
                  }
                  br.close();
                  // disconnect HttpURLConnection
                  huc.disconnect() ;
            }
            catch (IOException e){
                  return "Unable to open connection: " + e.getMessage();
            }
            return sb.toString();
      }

It is then just a question of parsing this String for instances of <a href="xxx"....... and adding them to a database for new links.

What you could do is crawl a limited number of websites, store the page String returned from the above method in the database and then search on a word in the database.  

Any questions?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.