• Post Reply Bookmark Topic Watch Topic
  • New Topic

Parsing of String  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all:
What I am doing is that, I obtain whoIs information about a specific domain by opening up a url connection to www.networksolutions.com and I currently read that information into a text file and then parse that text file for the pieces of information that I require.
My question is that should I read that data from a web site into a text file or into a StringBuffer, which one is better since I will be further parsing that data, so that I can obtain specific values and compare them with column values that I am retrieving from a domain table in the database.
Pls let me know which approach is the best so that I can effectively parse the data.
Thanks,
Shital Kapadia
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would fer sure try to do it in memory rather than involving a disk file. Could you make the parser accept input as a stream, read a byte from the URL and write it to the parser? The parser could be reused with any kind of stream source.
 
Shital Kapadia
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Stan:
This is what my cod looks so far for establishing a http connection to a particular web site, I am not sure of what you are saying, can you pls provide me with a code example.
private String whoIsURL = "http://www.networksolutions.com/cgi-bin/whois/whois?STRING=";
whoIsURL += (searchData + "&SearchType=do");
URL url = new URL(whoIsURL); // establish the connection
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
After receiving the data in the BufferedReader, I simply output it to the console right now, but this is where I was wondering as to whether I should write this out to a file or a StringBuffer which I could then use for parsing.
Thanks,
Shital Kapadia
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!