Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting "data" from HTML -page....

Status
Not open for further replies.

Tlogist

Programmer
Jan 13, 2002
5
0
0
FI
Hello!
I'm planning to do a small java-applet which would
for example get temperature from a HTML-page...

How complicated is this to do? I think I need to
get the whole page first on my computer and then search for the temperature (which is in normal textformat) and finally copy it to my applet...?

-TlogisT
 
Hello Tlogist,

That's exactly what you'd need to do. It shouldn't be too difficult a task, either. You can get a stream to any URL, and retrieve the contents of the HTML page into a String. Then you can parse through the String any way you'd like and pull out the appropriate value. The only risk you run there is that the formatting of the HTML could change over time, in which case your applet may not work correctly any more.

Another viable option would be to find a publicly available temperature/weather service via a web protocol like SOAP. You could then connect to the service, make a remote method call, and retrieve the temperature that way.

For more information on SOAP and Java, see:

For a list of publicly available web services, see:

Enjoy,
Adam Rice
 
Thank you very much for the information!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top