import java.io.*;
class game{
int s;
String bun;
int[] x=new int[10000];
int[] y=new int[10000];
String[] xml=new String[10000];
int xmlnumber;
game() {
getdata("data/1973.txt");
xymaker(bun);
System.out.println(xmlnumber);
for(s=1;s<xmlnumber+1;s++){
xml[s]=makexml(s,bun);
System.out.println(xml[s]);
}
}
public static void main(String[] args) {
game test = new game();
}
void getdata(String str){
int n,nx;
String sp;
String a[]=new String[1000];
n=0;
try {
FileReader fr = new FileReader(str);
BufferedReader br = new BufferedReader(fr);
while((sp = br.readLine()) != null) {
a[n]=sp;
n=n+1;
}
fr.close();
} catch (IOException e) {System.out.println(e);}
nx=n;
bun=a[0];
for (n=1;n<nx;n++){
bun=bun+a[n];
}
}
void xymaker(String str){
int p1;
int s;
s=1;
p1=str.indexOf("<");
x[1]=p1;
while(p1>-1){
p1=str.indexOf("<",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]=str.indexOf(">",x[s]);
}
}
String makexml(int s,String str){
int p1,p2;
String bara;
p1=x[s];
p2=y[s];
bara=str.substring(p1+1,p2);
return bara;
}
}
最終更新:2011年04月05日 05:20