Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

url connection query  RSS feed

 
sachin_ckd
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a query in fetching the page content of any site
using url class in java.
i have tried with the url constructor as
*************

import java.net.*;
import java.io.*;
public class URLReader {
public static void main(String[] args) throws Exception {
URL yahoo = new URL("http://www.yahoo.com/");
BufferedReader in = new BufferedReader(
new InputStreamReader(
yahoo.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}

*************

i get the content of the page along with the html tags using this program.
is their not any way by which i can eliminate these html tags
ang get only the text into my output screen??
please guide me
 
maateen ashraf
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one way is to scan the whole string which elimenate the tags
after scanning tag by tag.....
other way is to display the result in textarea
by setting its property to html....
 
gautham kasinath
Ranch Hand
Posts: 583
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to develop a proxy server but then after I get the urlconnectioon and read the site the site contents with the images get downloaded.. mind you the images are also getting downloaded.. cud you please tell me how to design the server.
Regds
Gautham Kasinath
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!