import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.io.IOException;
import java.net.URL;
//Jsoup对象的几种解析方法
public class JsoupDemo2 {
public static void main(String[] args) throws IOException {
//1.Jsoup.parse(File in,charset)
// String path = JsoupDemo2.class.getClassLoader().getResource("student.xml").getPath();
// Document document = Jsoup.parse(new File(path), "utf-8");
// System.out.println(document);
// 2.Jsoup.parse(String html)
// Document document = Jsoup.parse(" <students>\n" +
// " \t<student number=\"heima_0001\">\n" +
// " \t\t<name>tom</name>\n" +
// " \t\t<age>18</age>\n" +
// " \t\t<sex>male</sex>\n" +
// " \t</student>\n" +
// "\n" +
// "\n" +
// "\t<student number=\"heima_0002\">\n" +
// "\t\t<name>jerry</name>\n" +
// "\t\t<age>18</age>\n" +
// "\t\t<sex>male</sex>\n" +
// "\t</student>\n" +
// " </students>");
// System.out.println(document);
//3.解析网络路径
URL url = new URL("https://baike.baidu.com/item/jsoup/9012509?fr=aladdin");
Document document = Jsoup.parse(url, 10000);
System.out.println(document);
}
}