Java2DRenderer unable to parse some html element without optional end-tag

18 views
Skip to first unread message

Максим

unread,
Oct 13, 2024, 4:01:24 PM10/13/24
to Flying Saucer Users
I am not an html dev, sorry if I say smth stupid.
Tags like "link", "meta" doesn't require end-tag (/>), but Java2DRenderer is unable to parse them
code to render html (and save it as img) - https://pastebin.com/raw/qbvScHkM
short version of html (it is generated, so I can't just add / where needed) - https://pastebin.com/raw/JjjLHBPq

Olivier Bourgain

unread,
Oct 14, 2024, 3:37:31 AM10/14/24
to flying-sa...@googlegroups.com
Hi Максим

Even if HTML doesn't require all tags to be closed, flying-saucer does.

You can either change your HTML, or modify it in Java using Jsoup for example:
org.jsoup.nodes.Document document = Jsoup.parse(html);
document.outputSettings().syntax(Document.OutputSettings.Syntax.xml);
html = document.html();


--
You received this message because you are subscribed to the Google Groups "Flying Saucer Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flying-saucer-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flying-saucer-users/bc1b54cc-bc1a-4f34-90a4-166528fe45ban%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages