Java jsoup select不使用整个html?
什么是我的错 Android代码:Java jsoup select不使用整个html?,java,android,html,networking,jsoup,Java,Android,Html,Networking,Jsoup,什么是我的错 Android代码: ArrayList<String> plan_table = new ArrayList<>(); Element table = doc.select("table").get(1); //First Table: Untis Banner and School Data (Adress, etc.); Second Table: Plan -> So load second plan (index 1) Elements ro
ArrayList<String> plan_table = new ArrayList<>();
Element table = doc.select("table").get(1); //First Table: Untis Banner and School Data (Adress, etc.); Second Table: Plan -> So load second plan (index 1)
Elements rows = table.select("tr");
Log.i("SchollgymPlanThread","This are the rows: "+rows.toString());
for (int i = 1; i < rows.size(); i++) { //first row is the col names so skip it
Element row = rows.get(i);
Elements cols = row.select("td");
//Log.i("SchollgymPlanThread", cols.get(0).text());
plan_table.add(cols.get(0).text());
if (Pattern.matches("^Klasse .*",cols.get(0).text())) {PlanParsed.put(cols.get(0).text(), new LinkedHashMap<String,List>()); current_class=cols.get(0).text();continue;}
if (current_class != null) {
List<String> tmpList = new ArrayList<String>();
for (int i2 = 1; i2 < cols.size(); i2++) {
if (i2 == 2) {continue;} //If Lessons Hour , continue -> Lesson our will be put as key and not in the list
tmpList.add(cols.get(i2).text());
}
Log.i("SchollgymPlanThread", tmpList.toString());
if (cols.size() < 2) {continue;}
PlanParsed.get(current_class).put(cols.get(2).text(), tmpList); //ParsedPlan[current_class] = {lesson_hour:lesson_attributes}
}
//if ( row.className() == "list odd" ) {Log.i("SchollgymPlanThread","This is a class: "+cols.get(0).text());}
//if (cols.get(7).text().equals("down")) {
// plan_table.add(cols.get(5).text());
//}
我没有插入整个java代码,但这就是我的问题所在。。。
在第4行,它打印出带有td和tr的html代码,但它突然停止。输出的最后一行是:
<td cla
有什么问题吗?我已经查看了源网站…如何使用Jsoup阅读html?我问,因为您可能会达到加载文档的大小限制。如果未通过该方法另行告知,则Jsoup限制为1M。因此,您可能需要执行以下操作:
Document doc = Jsoup.connect("YOUR_URL").maxBodySize(0).get();
logcat使用一个缓冲区,您可能会填充它。尝试打印到一个文件中,看看输出是否仍然在中间剪辑。我会试试看。谢谢你的问题解决了吗?如果是这样,请考虑接受答案。如果没有,请重新表述您的问题,以便我们更好地了解如何提供帮助。我无法尝试您的解决方案,因为我的计算机当前无法工作。我在手机上写这封信;当然,如果答案有效,我会接受;我使用URL对象,然后将ist传递给Jsoup。我将尝试连接方法