RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 2175 | Replies: 3
Reply
Join Date: Mar 2005
Posts: 27
Reputation: crestaldin is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
crestaldin crestaldin is offline Offline
Light Poster

Question HTML parsing

  #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 ?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 4,832
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 324
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: HTML parsing

  #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.
... the hat of 'is this a cat in a hat?'
Reply With Quote  
Join Date: Mar 2005
Posts: 27
Reputation: crestaldin is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
crestaldin crestaldin is offline Offline
Light Poster

Re: HTML parsing

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

Re: HTML parsing

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

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:46 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC