You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using KMM with Okio, and i'm triying to serialise/parse a large xml file, I see on https://docs.korge.org/korio/serialization/ how to parse a String but since my file is too large, im triying to parse the stream :
val fileSystem = FileSystem.SYSTEM_TEMPORARY_DIRECTORY
val path = fileSystem / "myfile.xml"
// open a source stream
val sourceFileRead= fileSystem2.source(path)
// wrap stream with a buffer
val fileopened = sourceFileRead.buffer()
// read until end of file
var line: String?
var numLigne :Int =0
while (fileopened.readUtf8Line().also { line = it } != null) {
println(line)
var xmlLine = line?.reader(line!!,numLigne)
Xml.Stream.parse(xmlLine!!) // <-- Not gonna work but i dont know how to do ?
}
Thanks for your help if you have a solution
The text was updated successfully, but these errors were encountered:
It is not posible right now. Xml streaming uses StrReader that was designed to use a String in memory. It was like that to be as fast as possible (no virtual methods, no suspension points, all in-memory).
The thing is that K/N have evolved a lot and now maybe the performance is much better, so might make sense now to create a String Reader that support streams without having the whole file in memory and make Xml to use it.
I have created a PR with a baby step towards it
Hello,
I'm using KMM with Okio, and i'm triying to serialise/parse a large xml file, I see on https://docs.korge.org/korio/serialization/ how to parse a String but since my file is too large, im triying to parse the stream :
Thanks for your help if you have a solution
The text was updated successfully, but these errors were encountered: