アットウィキロゴ

とり

import java.io.*;

class ren{

String urlx,bun;
String[] data=new String[1000];
String[] link=new String[1000];
int[] x=new int[100];
int[] y=new int[100];
int s,datanumber,xmlnumber;

public static void main(String [] args) {
        ren test=new ren();
            }

ren(){

readfile("link.txt");

link[1]=data[1];

urlx=link[1];

getdata gt=new getdata();
gt.makedata(urlx);
bun=gt.data;


xymaker(bun);
System.out.println(xmlnumber);

System.out.println(bun.substring(x[1],y[1]));



}

void xymaker(String bun){
int s,p1;
s=1;
p1=bun.indexOf("<p>");
x[s]=p1;
while(p1>1){
p1=bun.indexOf("<p>",p1+1);
if(p1>1)s=s+1;
if(p1>1)x[s]=p1;
}
xmlnumber=s;
for(s=1;s<xmlnumber+1;s++){
y[s]=bun.indexOf("</p>",x[s]);
}

}
void readfile(String file){

String str;
BufferedReader br;  

s=0;

try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));  
while((str = br.readLine()) != null) {  
s=s+1;
data[s]=str;  
}
br.close();
} catch (IOException e) {System.out.println(e);}  

datanumber=s;
}

}
最終更新:2011年06月29日 23:50