public void loadCoreData() throws Exception {
URL url=new URL(this.path);
this.glossCount=0.0;
try
{
Document xml=this.loadURL(url);
if(language.equals("en"))
{
for(Element div:xml.getDescendants(new ElementFilter("a")))
{
if(div.getAttributeValue("href")!=null&&div.getAttributeValue("href").equals("/wiki/Special:Statistics"))
{
String str=div.getValue();
System.out.println(str);
this.glossCount=Double.parseDouble(str.replace(",", ""));
break;
}
}
}
else
{
for(Element div:xml.getDescendants(new ElementFilter("li")))
{
if(div.getAttributeValue("id")!=null && div.getAttributeValue("id").contains("lang-"))
{
for(Element span:div.getDescendants(new ElementFilter("span")))
{
if(span.getAttributeValue("lang").equals(language))
{
String str=div.getValue();
str=str.substring(0,str.indexOf(" articles"));
str=str.split("More than ")[1];
System.out.println(str);
this.glossCount=Double.parseDouble(str.replace(",", ""));
}
}
}
}
}
if(language.equals("es"))
{
String f=xml.getRootElement().getValue();
f=f.substring(f.indexOf(" art�culos en espa�ol")-30,f.indexOf("art�culos en espa�ol")).split("\n")[1].replace("\u00a0","");
this.glossCount=Double.parseDouble(f);
}
this.wordCount=this.glossCount*320.0;
url=new URL(this.path);