【发布时间】:2015-02-06 09:56:56
【问题描述】:
我正在做一个学校项目,并试图解析一个 html 网页以仅显示标签,就像下面没有结束标签的输出一样。 (我手动编码)
<html>
<head>
<title>
<basefont>
<body>
<h1>
<h2>
到目前为止,这是我的主要方法中的代码。
public class ReadWithScanner {
public static void main(String[] args) throws IOException
{
String URL ="http://csb.stanford.edu/class/public/pages/sykes_webdesign/05_simple.html";
Document doc = Jsoup.connect(URL).get();
//Element p = doc.select("p");
//Elements p = doc.getElementsByTag("h6");
Elements p = doc.select("html");
//System.out.println(p);
DoublyLinkedList theList = new DoublyLinkedList();
theList.insert(p); // insert at front
theList.displayTree();
}
}
到目前为止,这是我的输出的几行。
【问题讨论】:
-
有什么问题?
-
如何在 JSoup java 中只显示 html 标签?
标签: java html eclipse parsing jsoup