package api;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[50000];
String[] id=new String[500];
String[] name=new String[500];
String[] tab=new String[500];
int number;
public static void main(String[] args) {
pro t=new pro();
}
pro(){
String code="00200603";
String urlx="http://api.e-stat.go.jp/rest/2.1/app/getStatsList?appId=aeec3b02995623cad42b80c80f73d176b7c77970";
urlx=urlx+"&statsCode="+code;
getdata sub=new getdata();
sub.makedata(urlx,"UTF-8");
data=sub.data;
datanumber=sub.datanumber;
String str="";
for(s=1;s<datanumber+1;s++){
str=str+data[s];
}
String[] x=str.split("</TABLE_INF>");
String[] de=new String[5000];
int sx=0;
for(s=1;s<x.length;s++){
if(x[s].indexOf("<TABLE_INF")>-1)sx=sx+1;
if(x[s].indexOf("<TABLE_INF")>-1)de[sx]=x[s];;
}
number=sx;
for(s=1;s<number+1;s++){
int p1=de[s].indexOf("<TABLE_INF");
int p2=de[s].indexOf(">",p1+1);
id[s]=de[s].substring(p1,p2);
id[s]=id[s].replace("<TABLE_INF id=","");
System.out.println(id[s]);
p1=de[s].indexOf("<STATISTICS_NAME>");
p2=de[s].indexOf("</STATISTICS_NAME>",p1+1);
name[s]=de[s].substring(p1,p2);
name[s]=name[s].replace("<STATISTICS_NAME>","");
System.out.println(name[s]);
p1=de[s].indexOf("<TITLE>");
p2=de[s].indexOf("</TITLE>",p1+1);
tab[s]="";
if(p1>-1)tab[s]=de[s].substring(p1,p2);
tab[s]=tab[s].replace("<TITLE>","");
System.out.println(tab[s]);
}
}
}
最終更新:2017年03月02日 22:38