From f6f8807b3a3562ed1b690e7c642ca7dd9c40a14e Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Thu, 17 Sep 2020 22:17:58 +0200 Subject: [PATCH] Preserve feeds elements whitespaces --- .../main/java/com/readrops/api/utils/KonsumerExtensions.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/com/readrops/api/utils/KonsumerExtensions.kt b/api/src/main/java/com/readrops/api/utils/KonsumerExtensions.kt index adef66de..f1760e85 100644 --- a/api/src/main/java/com/readrops/api/utils/KonsumerExtensions.kt +++ b/api/src/main/java/com/readrops/api/utils/KonsumerExtensions.kt @@ -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 } \ No newline at end of file