Parser

class Parser

Parses HTML or XML into a com.fleeksoft.ksoup.nodes.Document. Generally, it is simpler to use one of the parse methods in com.fleeksoft.ksoup.Ksoup.

Note that a Parser instance object is not threadsafe. To reuse a Parser configuration in a multi-threaded environment, use .newInstance to make copies.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
Link copied to clipboard

Retrieve the parse errors, if any, from the last parse.

Link copied to clipboard

(An internal method, visible for Element. For HTML parse, signals that script and style text should be treated as Data Nodes).

Link copied to clipboard
Link copied to clipboard

Creates a new Parser as a deep copy of this; including initializing a new TreeBuilder. Allows independent (multi-threaded) use.

Link copied to clipboard
fun parseFragmentInput(fragment: String, context: Element?, baseUri: String?): List<Node>
Link copied to clipboard
fun parseInput(inputHtml: BufferReader, baseUri: String): Document
fun parseInput(htmlBytes: ByteArray, baseUri: String): Document
fun parseInput(html: String, baseUri: String): Document
Link copied to clipboard

Gets the current ParseSettings for this Parser

fun settings(settings: ParseSettings?): Parser

Update the ParseSettings of this Parser, to control the case sensitivity of tags and attributes.

Link copied to clipboard
fun setTrackErrors(maxErrors: Int): Parser

Enable or disable parse error tracking for the next parse.

Link copied to clipboard
fun setTrackPosition(trackPosition: Boolean): Parser

Enable or disable source position tracking. If enabled, Nodes will have a Position to track where in the original input source they were created from.