mirror of
https://github.com/readrops/Readrops.git
synced 2025-01-23 23:32:36 +01:00
Preserve feeds elements whitespaces
This commit is contained in:
parent
82c29d0732
commit
f6f8807b3a
@ -1,13 +1,14 @@
|
||||
package com.readrops.api.utils
|
||||
|
||||
import com.gitlab.mvysny.konsumexml.Konsumer
|
||||
import com.gitlab.mvysny.konsumexml.Whitespace
|
||||
|
||||
fun Konsumer.nonNullText(failOnElement: Boolean = true): String {
|
||||
val text = text(failOnElement = failOnElement)
|
||||
val text = text(failOnElement = failOnElement, whitespace = Whitespace.preserve)
|
||||
return if (text.isNotEmpty()) text else throw ParseException("Xml field $name can't be null")
|
||||
}
|
||||
|
||||
fun Konsumer.nullableText(failOnElement: Boolean = true): String? {
|
||||
val text = text(failOnElement = failOnElement)
|
||||
val text = text(failOnElement = failOnElement, whitespace = Whitespace.preserve)
|
||||
return if (text.isNotEmpty()) text else null
|
||||
}
|
Loading…
Reference in New Issue
Block a user