- INSTANT Jsoup How-to
- Pete Houston
- 186字
- 2021-08-20 16:52:35
How it works...
Basically, all the inputs will be given to the Jsoup
class to parse.
For an HTML string, you just need to pass the HTML string as parameter for the method Jsoup.parse()
.
For an HTML file, there are three parameters inputted for Jsoup.parse()
. The first one is the file object, which points to the specified HTML file; the second one is the character set of the file. There is an overload of this method with an additional third parameter, Jsoup.parse(File file, String charsetName, String baseUri)
. The baseUri
URL is the URL from where the HTML file is retrieved; it is used to resolve relative paths or links.
For a URL, you need to use the Jsoup.connect()
method. Once the connection succeeds, it will return an object, thus implementing the connection interface. Through this, you can easily get the content of the URL page using the Connection.get()
method.
The previous example is pretty easy and straightforward. The results of parsing from the Jsoup
class will return a Document
object, which represents a DOM structure of an HTML page, where the root node starts from <html>
.
- 多媒體CAI課件設計與制作導論(第二版)
- 工程軟件開發技術基礎
- Mastering Ember.js
- Three.js開發指南:基于WebGL和HTML5在網頁上渲染3D圖形和動畫(原書第3版)
- KnockoutJS Starter
- Python時間序列預測
- Python從入門到精通(第3版)
- OpenCV 3計算機視覺:Python語言實現(原書第2版)
- Python商務數據分析(微課版)
- HTML+CSS+JavaScript網頁制作:從入門到精通(第4版)
- Scala Functional Programming Patterns
- Docker:容器與容器云(第2版)
- Python應用與實戰
- Practical Responsive Typography
- Learning WebRTC