Forums Register Login

How to read text content not source code from webpage in java ?

+Pie Number of slices to send: Send
Hi Guyz..
How to read text content not source code from webpage using java ?

Thanks,
http://teknoturfian.blogspot.com
+Pie Number of slices to send: Send
In java.net package we have URLConnection class is there. we can use that to connect to some URL and request and get response from that.
+Pie Number of slices to send: Send
Hi Venkateswara ,
Thanks for your reply,
I tried this,


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;


public class URLExp {

public static void main(String[] args) {
try {
URL google = new URL("http://www.google.com/");
URLConnection yc = google.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(yc
.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);

}
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}

}


BUT...
what happend i can get the source code of the webpage ,I need text based real content.So what i do?...
+Pie Number of slices to send: Send
 

Marimuthu Udayakumar wrote:BUT...
what happend i can get the source code of the webpage ,I need text based real content.So what i do?...


You'd have to parse the HTML in your program and get the text out of it yourself.
+Pie Number of slices to send: Send
1
+Pie Number of slices to send: Send
Hello Jesper Young ,
Thanks for your query,I made it.

Hi Rob Prime,
Thanks for your suggesstion that code Tag, I used that Tag too here...

I used NekoHTML parser ..




I used jar files named nekohtml.jar and xercesImpl.jar for parser ,
I am not able to attach those jarfiles here.just you can download from web,
If you dont get it just mail me to teknoturfian@gmail.com
I will send it to you..
Thanks guys...Have a good day...
http://www.wix.com/muthu_tek/Marimuthu-at-Teknoturf
http://teknoturfian.blogspot.com

" I aim to bring Passion and Quality to every relationship"
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 23432 times.
Similar Threads
textarea
Writing to a resource inside the JAR, URI not hierarchical?
Display colored output to a console/terminal with java
This weeks Giveaway
Read Data from webpage
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:25:48.