アットウィキロゴ

こでx87

package base2;
 
import tool.*;
import java.io.*; 
 
public class pro {
 
 
    int s,datanumber;
    String[] data=new String[5000];
     String[][] point=new String[50][20];
    String[] point_v=new String[50];
    int number; 
    String name_h,name_v;
    int creditnumber;
 
    public static void main(String[] args) {
        pro t=new pro();
    }
 
pro(){
 
    int tr;
 
    for(tr=1;tr<888;tr++){
 
    readfile sub7=new readfile();
        sub7.makedata("data/"+tr+".txt","UTF-8");
        data=sub7.data;
        datanumber=sub7.datanumber;
 
 
        int h,s1;
        s1=0;
        for(s=1;s<datanumber+1;s++){
        h=0;
        if(data[s].indexOf("<table")>-1)h=h+1;   
         if(data[s].indexOf("hspace=")>-1)h=h+1; 
        if(s1==0)h=h+1;
        if(h==3)s1=s;
        }
 
        int s2=0;
        for(s=s1+1;s<datanumber;s++){
 
        h=0;
        if(data[s].indexOf("</table")>-1)h=h+1;   
        if(s2==0)h=h+1;
        if(h==2)s2=s;
        }
 
 
        String str="";
        for(s=s1;s<s2+1;s++){
       str=str+data[s];
        }
 
        String[] x=str.split("</tr>");
 
 
   for(s=0;s<x.length;s++){
 
    }
 
 
   int sx;
   creditnumber=0;
   number=x.length;
   for(s=0;s<number-1;s++){
   String[] x1=x[s].split("</td>"); 
   for(sx=0;sx<x1.length;sx++){
   point[s][sx]=x1[sx];
   }
  if(s==1)creditnumber=x1.length;
   }
 
    System.out.println(creditnumber);
 
   for(s=0;s<number-1;s++){ 
   for(sx=0;sx<creditnumber;sx++){
   point[s][sx]=rev(point[s][sx]);
   }}
 
 
   writexml("gdata/"+tr+".txt");
 
}
 
}
 
String rev(String str){
   if(str==null)str=""; 
   int p1=str.indexOf("<td");
   p1=str.indexOf(">",p1);
    String strx="";
    if(p1>-1)strx=str.substring(p1+1,str.length());
    return strx;
 
}
    String rev2(String str){
   if(str==null)str=""; 
   int p1=str.indexOf("<span");
   p1=str.indexOf(">",p1);
   int p2=str.indexOf("<",p1+1);
    String strx="";
    if(p1>-1)strx=str.substring(p1+1,p2);
    return strx;
 
}
 
 void writexml(String file){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
for(s=0;s<number-1;s++){ 
for(sx=0;sx<creditnumber;sx++){ 
pw.print("<index>"); 
pw.print(s); 
pw.print("</index>"); 
pw.print("<credit>"); 
pw.print(sx); 
pw.print("</credit>"); 
pw.print("<point>");
pw.print(point[s][sx]);
pw.println("</point>"); 
}}
 
 
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
 
 
}
 
最終更新:2015年09月30日 12:31