【发布时间】:2012-12-29 07:16:46
【问题描述】:
我的代码:
public static void main(String[] args) {
Validate.isTrue(true, "usage: supply url to fetch");
try{
String url="http://www.spoj.com/ranks/PRIME1/";
Document doc= Jsoup.connect(url).get();
Elements es=doc.getElementsByAttributeValue("class","lightrow");
System.out.println(es.get(0).child(0).text());
}catch(Exception e){e.printStackTrace();}
}
获取:
Exception in thread "main" java.lang.IllegalArgumentException: usage: supply url to fetch
at org.jsoup.helper.Validate.isTrue(Validate.java:45)
at org.jsoup.examples.HtmlToPlainText.main(HtmlToPlainText.java:26)
请指出我的错误以及为什么会出错。我在 Jsoup 官方网站上举了一个例子。
【问题讨论】:
标签: java html-parsing jsoup