I have written java program which can extract online data from url and i want to store it in data base in new token row in table so than i can use in my application . how could it be done using type4 drive .. if any one had any solution kindly help me .....
these are my code ...
import javax.swing.text.html.parser.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
import java.io.*;
import java.util.StringTokenizer;
import java.net.*;
public class ParseTest extends HTMLEditorKit.ParserCallback {
HTML.Tag t=null;
String name1=null;
boolean flag1;
public void handleText(char[] data, int pos){
if(t==HTML.Tag.DIV && name1.equals("responseDiv")){
String csvString=new String(data);
StringTokenizer tokenizer = new StringTokenizer(csvString, ",");
while(tokenizer.hasMoreTokens())
{
System.out.println(tokenizer.nextToken());
}
System.exit(0);
}
}
public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos){
this.t=t;
if(t==HTML.Tag.DIV)
name1=(String)a.getAttribute(HTML.Attribute.ID);
}
public void handleEndTag(HTML.Tag t, int pos){
}
public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos){
}
public static void main(String argv[]){
try {
URL url = new URL("http://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuote.jsp?symbol=acc");
InputStream in =url.openStream();
InputStreamReader r=new InputStreamReader(in);
ParserDelegator parser = new ParserDelegator();
HTMLEditorKit.ParserCallback callback = new ParseTest();
parser.parse(r, callback, true);
} catch (IOException e){
e.printStackTrace();
}
}
}