failOnElement parameter doesn't work
Hello,
I'm trying to parse this element with text(failOnElement = false)
:
<description>
<p><img src="/blog/images/message-requests-header.jpg" alt="Screenshot of an incoming message request." /></p>
<p>The number of people who join Signal every day is still growing at a record pace. With so many new conversations getting started, we’ve heard from a lot of users that they’d like more control over how they begin.</p>
<p>With message requests, when someone who isn’t in your contacts starts a new chat with you or adds you to a group, you can quickly see more info before accepting the request, deleting it, or blocking the conversation.</p>
<p>
<a href="https://signal.org/blog/message-requests/"><em>Read more...</em></a>
</description>
The majority of the element content is escaped html, but there is a little a
element at the end which is not escaped.
According to the documentation, failOnElement
allows to consume mixed content as part of the element text until the end of it. But it doesn't work for me as I have this exception:
com.gitlab.mvysny.konsumexml.KonsumerException: line 29 column 66 at null null, in element <description>: Expected END_ELEMENT but got START_ELEMENT: 'a'
.
I reproduced with this little unit test:
@Test
fun konsumeTest() {
val text = """<description>
<p><img src="/blog/images/message-requests-header.jpg" alt="Screenshot of an incoming message request." /></p>
<p>The number of people who join Signal every day is still growing at a record pace. With so many new conversations getting started, we’ve heard from a lot of users that they’d like more control over how they begin.</p>
<p>With message requests, when someone who isn’t in your contacts starts a new chat with you or adds you to a group, you can quickly see more info before accepting the request, deleting it, or blocking the conversation.</p>
<p>
<a href="https://signal.org/blog/message-requests/"><em>Read more...</em></a>
</description>""".trimIndent()
val konsume = text.konsumeXml()
konsume.child("description") {
val description = text(failOnElement = false)
}
}
Did I understand correctly the purpose of failOnElement
or is it used for something else?