Here you can find the source of parseTemplate1_1(Element element)
public static synchronized void parseTemplate1_1(Element element) throws JSONException
//package com.java2s; //License from project: Apache License import org.json.JSONException; import org.json.JSONObject; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { public static synchronized void parseTemplate1_1(Element element) throws JSONException { JSONObject jsonObject = new JSONObject(); JSONObject jsonItem = new JSONObject(); Element infotemplatebox = element.getElementsByClass( "infotemplatebox").first(); Elements elements = infotemplatebox.select("tr"); for (int i = 0, total = elements.size(); i < total; i++) { Element item = elements.get(i); // System.err.println(item); if (i == 0) { jsonObject.put("cover", item.select("img").attr("src")); } else if (i > total - 3) { if (i == total - 1) { jsonItem.put(elements.get(i - 1).text(), item.text()); }/*from w w w. j ava 2 s . com*/ } else { Elements th = item.select("th"); Elements td = item.select("td"); if (th.size() == 0 || td.size() == 0) { jsonObject.put(td.size() == 0 ? th.text() : td.text(), jsonItem); } else { jsonItem.put(th.text(), td.text()); } } } System.err.println(jsonObject.toString()); element.getElementsByClass("infoBox").remove(); element.getElementsByClass("infotemplatebox").remove(); elements = element.select("p"); // System.err.println(elements.text()); } }