Forums Register Login

Parsing of String

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 699 times.
Similar Threads
Peformance comparison question
How to avoid special charcters from a file
Parse a text file and save to a database
parsing xml document element values
How to convert a .doc file to .txt file
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:45:40.