KtSoupDocument

Represents a DOM document providing APIs to query and manipulate the document.

Functions

Link copied to clipboard
expect fun attr(name: String): String?

Get the name attribute value or null if the attribute is missing.

actual fun attr(name: String): String?
actual fun attr(name: String): String?
actual fun attr(name: String): String?
Link copied to clipboard
expect fun attrs(): Map<String, String>

Get all attributes for this element.

actual fun attrs(): Map<String, String>
actual fun attrs(): Map<String, String>
actual fun attrs(): Map<String, String>
Link copied to clipboard
expect fun body(): KtSoupElement?

Get a KtSoupElement representing the document's body or null if there is no body.

actual fun body(): KtSoupElement?
actual fun body(): KtSoupElement?
actual fun body(): KtSoupElement?
Link copied to clipboard
expect fun child(index: Int): KtSoupNode?

Get the child KtSoupNode at the given index or null if the index is out of range.

actual fun child(index: Int): KtSoupNode?
actual fun child(index: Int): KtSoupNode?
actual fun child(index: Int): KtSoupNode?
Link copied to clipboard
expect fun children(): List<KtSoupNode>

Get a list of all the child nodes.

actual fun children(): List<KtSoupNode>
actual fun children(): List<KtSoupNode>
actual fun children(): List<KtSoupNode>
Link copied to clipboard
expect fun className(): String?

Get the class attribute value or null if there is no class attribute.

actual fun className(): String?
actual fun className(): String?
actual fun className(): String?
Link copied to clipboard
expect fun close()

Free all resources used for this document.

actual fun close()
actual fun close()
actual fun close()
Link copied to clipboard
expect open operator override fun equals(other: Any?): Boolean
actual open operator override fun equals(other: Any?): Boolean
actual open operator override fun equals(other: Any?): Boolean
actual open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Get the first element with an id attribute matching id or null if there are no matching elements.

Link copied to clipboard
expect fun getElementsByClass(className: String): List<KtSoupElement>

Get all elements with the provided className.

actual fun getElementsByClass(className: String): List<KtSoupElement>
actual fun getElementsByClass(className: String): List<KtSoupElement>
actual fun getElementsByClass(className: String): List<KtSoupElement>
Link copied to clipboard

Get all elements with the provided tagName.

Link copied to clipboard
expect open override fun hashCode(): Int
actual open override fun hashCode(): Int
actual open override fun hashCode(): Int
actual open override fun hashCode(): Int
Link copied to clipboard
expect fun head(): KtSoupElement?

Get a KtSoupElement representing the document's head or null if there is no head.

actual fun head(): KtSoupElement?
actual fun head(): KtSoupElement?
actual fun head(): KtSoupElement?
Link copied to clipboard
expect fun html(): String

Get the outer HTML as a string or the textContent if it's not an Element.

actual fun html(): String
actual fun html(): String
actual fun html(): String
Link copied to clipboard
expect fun id(): String?

Get the id attribute value or null if there is no id attribute.

actual fun id(): String?
actual fun id(): String?
actual fun id(): String?
Link copied to clipboard
expect fun nodeName(): String

Get the node name of this node.

actual fun nodeName(): String
actual fun nodeName(): String
actual fun nodeName(): String
Link copied to clipboard
expect fun nodeType(): KtSoupNodeType

Get the KtSoupNodeType of this node.

actual fun nodeType(): KtSoupNodeType
actual fun nodeType(): KtSoupNodeType
actual fun nodeType(): KtSoupNodeType
Link copied to clipboard
expect fun parent(): KtSoupNode?

Get this node's parent KtSoupNode or null if it has no parent.

actual fun parent(): KtSoupNode?
actual fun parent(): KtSoupNode?
actual fun parent(): KtSoupNode?
Link copied to clipboard
expect fun querySelector(selector: String): KtSoupElement?

Get the first KtSoupElement matching the css selector or null if there are no matches.

actual fun querySelector(selector: String): KtSoupElement?
actual fun querySelector(selector: String): KtSoupElement?
actual fun querySelector(selector: String): KtSoupElement?
Link copied to clipboard
expect fun querySelectorAll(selector: String): List<KtSoupElement>

Get all KtSoupElements matching the css selector.

actual fun querySelectorAll(selector: String): List<KtSoupElement>
actual fun querySelectorAll(selector: String): List<KtSoupElement>
actual fun querySelectorAll(selector: String): List<KtSoupElement>
Link copied to clipboard
expect fun tagName(): String

Get the tag name of this element.

actual fun tagName(): String
actual fun tagName(): String
actual fun tagName(): String
Link copied to clipboard
expect fun textContent(): String

Get the text content of this node.

actual fun textContent(): String
actual fun textContent(): String
actual fun textContent(): String
Link copied to clipboard
expect fun title(): String

Get the document's title or an empty string if no title is found.

actual fun title(): String
actual fun title(): String
actual fun title(): String
Link copied to clipboard
expect open override fun toString(): String
actual open override fun toString(): String
actual open override fun toString(): String
actual open override fun toString(): String
Link copied to clipboard
expect inline fun <R> use(crossinline block: (KtSoupDocument) -> R): R

A convenience function to interact with the document in block and automatically invoke close at the end.

actual inline fun <R> use(crossinline block: (KtSoupDocument) -> R): R
actual inline fun <R> use(crossinline block: (KtSoupDocument) -> R): R
actual inline fun <R> use(crossinline block: (KtSoupDocument) -> R): R