All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.model.KspoonDocument.kt Maven / Gradle / Ivy

Go to download

Annotation based HTML to Kotlin class parser with KMP support, jspoon successor

The newest version!
package dev.burnoo.kspoon.model

import com.fleeksoft.ksoup.nodes.Document
import dev.burnoo.kspoon.annotation.Selector
import dev.burnoo.kspoon.serializer.DocumentSerializer
import kotlinx.serialization.Serializable

/**
 * Wrapper that allows parsing [Document] returned from a function.
 * In some scenarios (e.g. using the library with ktor or Retrofit) it is necessary to indicate
 * what serializer should be used for parsing the [Document].
 *
 * Example:
 * ```
 * val body = """"""
 * val document = Kspoon.parse(body).document
 * ```
 */
@Serializable
public data class KspoonDocument(
    /**
     * Parsed [Document].
     */
    @Serializable(DocumentSerializer::class)
    @Selector(":root")
    val document: Document,
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy