New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAXParseException when trying to add an unclosed, raw <link>
tag into a head { ... }
block
#247
Comments
u should close tag like this: |
@qwertukg ah, I think you're missing the point. My example shows that the very html that kotlinx html itself generates, meaning it is valid html, turns into a parse error when you feed it back into itself. The reason I ran into this is because I had a pipeline where one part generated html from kotlinx and then another part consumed it. For the second part of the pipeline, the output of the first part is opaque, and its consumption automatic. You can't just edit it by hand because there's no human in the process. I worked around it in an ugly way long ago but this should not be a parse exception. |
The issue is that you're not quite "feeding it back into itself". The |
@severn-everett That's fair. I'll go ahead and mark the issue closed. I'm sure the team is busy, but you can of course reopen if the team wants to look into it more. It's too bad SAX can't be configured to be more flexible about void elements (or if it can, it's probably really tricky to do :) I remember fighting with SAX a decade ago and I'm not advocating the kotlinx html team spend any time fighting SAX because it seems like this isn't a common problem :) At some point, our codebase switched to using Jsoup to parse the incoming html text, which seems like a clean enough workaround to recommend in case anyone else comes across this thread in the future. |
Specifically,
org.xml.sax.SAXParseException; The element type "link" must be terminated by the matching end-tag "</link>".
Expected:
kotlinx.html
can receive unclosed<link>
tags in the<head>
element.Actual: The
<link>
element, which is a void element and does not have to close in valid html (and in fact is howkotlinx.html
generates it) is getting triggered with a parse exception bykotlinx.html
Repro steps
Here's a very simple example to show the issue:
which outputs:
Writing the kotlinx.html code to represent that...
results in the unexpected stack trace:
The text was updated successfully, but these errors were encountered: