File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Converting HTML into Java code?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Converting HTML into Java code??" Watch "Converting HTML into Java code??" New topic

Converting HTML into Java code??

Master Rice

Joined: Aug 05, 2001
Posts: 8
I am a relatively new programmer who is trying to write an application that parses/retrieves information from an HTML page, and extracts relevant parts of the HTML (usually from tables) into Java Strings.
I have heard of javax.swing.text.html.parser. Would this do the job, and if so, can somebody give me some pointers on how to use it. Some simple sample code would be useful, just so that I can work out how to use it.
Thanks, Neil.
Suresh Bansal
Ranch Hand

Joined: Jul 23, 2001
Posts: 91
You can also try java class StringTokenizer, Its very simple to use. Just pass it a string with delimiters and it will return back all the tokens.

Journey is as important as the Destination.<br /> <br />PMP, SCJP, SCJD, SCEA (Part 1), SCMAD, SCDJWS
Chris Stehno
Ranch Hand

Joined: Feb 26, 2001
Posts: 180
You may also want to take a look at XMLC from Lutris (though I am not sure if there are still making it freely available). It builds a DOM object tree from an HTML document. You can then search through the tree to find the elements you want.
Hope this helps

Chris Stehno (Sun Certified Programmer for the Java 2 Platform)

- Chris Stehno, SCPJ
Consider Paul's rocket mass heater.
subject: Converting HTML into Java code??
It's not a secret anymore!