Update kotlin-xml-builder dependency

This commit is contained in:
Shinokuni 2024-11-08 17:19:06 +01:00
parent 47b40ac0eb
commit 783276a27b
2 changed files with 34 additions and 31 deletions

View File

@ -4,25 +4,28 @@ import com.gitlab.mvysny.konsumexml.konsumeXml
import com.readrops.api.utils.exceptions.ParseException
import com.readrops.db.entities.Feed
import com.readrops.db.entities.Folder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.redundent.kotlin.xml.xml
import java.io.InputStream
import java.io.OutputStream
object OPMLParser {
suspend fun read(stream: InputStream): Map<Folder?, List<Feed>> {
suspend fun read(stream: InputStream): Map<Folder?, List<Feed>> = withContext(Dispatchers.IO) {
try {
val adapter = OPMLAdapter()
val opml = adapter.fromXml(stream.konsumeXml())
stream.close()
return opml
opml
} catch (e: Exception) {
throw ParseException(e.message)
}
}
suspend fun write(foldersAndFeeds: Map<Folder?, List<Feed>>, outputStream: OutputStream) {
suspend fun write(foldersAndFeeds: Map<Folder?, List<Feed>>, outputStream: OutputStream) =
withContext(Dispatchers.IO) {
val opml = xml("opml") {
attribute("version", "2.0")

View File

@ -80,7 +80,7 @@ aboutlibraries = { module = "com.mikepenz.aboutlibraries.plugin:aboutlibraries-p
aboutlibraries-composem3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "about_libraries" }
konsumexml = "com.gitlab.mvysny.konsume-xml:konsume-xml:1.1"
kotlinxmlbuilder = "org.redundent:kotlin-xml-builder:1.7.3" #TODO update this
kotlinxmlbuilder = "org.redundent:kotlin-xml-builder:1.9.1"
jdk-desugar = "com.android.tools:desugar_jdk_libs_nio:2.1.2"