HTML parsing

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2005
Posts: 30
Reputation: crestaldin is an unknown quantity at this point 
Solved Threads: 0
crestaldin crestaldin is offline Offline
Light Poster

HTML parsing

 
0
  #1
Jul 31st, 2006
Hello,
I'm new to HTML parsing and I need some help.I want to parse a HTML file , and I have the Java classes in place but I need an advise on how to code a piece of logic in my callback function.

I need to parse through the file until I encounter the second table in the file and then display the contents of that particular table.

I'll be grateful if I can get help on this.

Thanks in advance..


Also I am getting a java.net.UnknownHostException: error when I enter any URL in my code. How can I solve that ?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,273
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: HTML parsing

 
0
  #2
Aug 1st, 2006
Originally Posted by crestaldin
Hello,
I'm new to HTML parsing and I need some help.I want to parse a HTML file , and I have the Java classes in place but I need an advise on how to code a piece of logic in my callback function.

I need to parse through the file until I encounter the second table in the file and then display the contents of that particular table.

I'll be grateful if I can get help on this.

Thanks in advance..
That's pretty simple. Set up a count. So it counts the number of times a <table border="1">is found. Check out the string api for the 'find' function.

Once it finds the second occurence push all the data into storage untill it gets to the </table>. For example, I'd push each line into an arraylist.


Also I am getting a java.net.UnknownHostException: error when I enter any URL in my code. How can I solve that ?
I guess you're trying to use the java.net package to access url's from your program. Read the documentation carefully. It's most likely to be a simple error. Are you putting a http:// before each web address? Post some code if you like.
Last edited by iamthwee; Aug 1st, 2006 at 5:54 am.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 30
Reputation: crestaldin is an unknown quantity at this point 
Solved Threads: 0
crestaldin crestaldin is offline Offline
Light Poster

Re: HTML parsing

 
0
  #3
Aug 1st, 2006
Thanks a lot iamthwee!
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 8
Reputation: b2daj is an unknown quantity at this point 
Solved Threads: 0
b2daj b2daj is offline Offline
Newbie Poster

Re: HTML parsing

 
0
  #4
Aug 9th, 2006
thanks i was also looking for exactly the same to help me with a xml parser project.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC