String html = "<html><body><div><h1>Hello, World!</h1></div></body></html>"; Source source = new Source(html); Element element = source.getElementById("div"); String text = element.getTextExtractor().toString(); System.out.println(text); List<Element> elements = source.getAllElements("div.myClass"); Source source = new Source(html); Element element = source.getElementById("div"); element.setAttributeValue("class", "newClass"); System.out.println(source.toString());


上一篇:
下一篇:
切换中文