943,625 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 4370
  • Java RSS
Jul 31st, 2006
0

HTML parsing

Expand Post »
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 ?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
crestaldin is offline Offline
30 posts
since Mar 2005
Aug 1st, 2006
0

Re: HTML parsing

Quote 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.


Quote ...
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.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Aug 1st, 2006
0

Re: HTML parsing

Thanks a lot iamthwee!
Reputation Points: 10
Solved Threads: 0
Light Poster
crestaldin is offline Offline
30 posts
since Mar 2005
Aug 9th, 2006
0

Re: HTML parsing

thanks i was also looking for exactly the same to help me with a xml parser project.
Reputation Points: 11
Solved Threads: 0
Newbie Poster
b2daj is offline Offline
8 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: hai friends plz suggest me
Next Thread in Java Forum Timeline: help me please... asap





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC