A multiplatform HTML5 parsing library built on Lexbor, Jsoup, and node-html-parser.
val documentString = """
<html>
<body>
<div id="test" class="test">Hello World</div>
</body>
</html>
"""
val document = KtSoupParser.parse(documentString)
document.use { document ->
val div = document.querySelector("#test")
println(div.textContent()) // Hello World
println(div.html()) // <div id="test" class="test">Hello World</div>
}
repositories {
mavenCentral()
// Or snapshots
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
implementation("org.drewcarlson:ktsoup-core:$VERSION")
implementation("org.drewcarlson:ktsoup-fs:$VERSION")
implementation("org.drewcarlson:ktsoup-ktor:$VERSION")
}
Toml (Click to expand)
[versions]
ktsoup = "1.0.0-SNAPSHOT"
[libraries]
ktsoup-core = { module = "org.drewcarlson:ktsoup-core", version.ref = "ktsoup" }
ktsoup-fs = { module = "org.drewcarlson:ktsoup-fs", version.ref = "ktsoup" }
ktsoup-ktor = { module = "org.drewcarlson:ktsoup-ktor", version.ref = "ktsoup" }
This project is licensed under Apache-2.0, found in LICENSE.