net.dankito.utils.html.JsoupNodeExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-utils Show documentation
Show all versions of java-utils Show documentation
Some basic utils needed in many projects
The newest version!
package net.dankito.utils.html
import org.jsoup.nodes.Node
import org.jsoup.select.NodeTraversor
fun Node.toPlainText(): String {
val formatter = FormattingVisitor()
NodeTraversor.traverse(formatter, this) // walk the DOM, and call .head() and .tail() for each node
return formatter.toString()
}