2013-03-08 18 views
4

解析網站時出現此錯誤。 錯誤:'實體「ContentType」的聲明必須以'>'結尾。' 或輸入類型必須關閉如何處理來自Web的無效HTML文檔,需要正確的HTML庫

+0

1:修復輸入,2修復庫,以便它可以處理incorect html – 2013-03-08 10:19:05

+0

試試[jsoup](http://jsoup.org/),它可以處理brocken html。 – A4L 2013-03-08 10:19:40

回答

2

你認爲是JTidy

JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty printer. Like its non-Java cousin, JTidy can be used as a tool for cleaning up malformed and faulty HTML. In addition, JTidy provides a DOM parser for real-world HTML.

顯然在某個時候會與HTML掙扎取決於它是多麼糟糕形成,但你會發現這對你的作品。

相關問題