Missing the end tag
Document parse = Jsoup.parse("<img th:src="" width="50" height="50" alt="fail" />");
String result = parse.html();
I need <img th:src="" width="50" height="50" alt="fail" />
but I get <img th:src="" width="50" height="50" alt="fail" >
where did the '/' go? and how can I get '/'?
jsoup defaults to HTML5, where self-closing tags aren't a thing. If you want XML, you can use the XML parser. See e.g. https://try.jsoup.org/~Qgdx_A13CctCvLA1C4WZRNhpJ-c
Also, best to use StackOverflow for Q&A; we use GitHub Issues for issue tracking.
jsoup defaults to HTML5, where self-closing tags aren't a thing. If you want XML, you can use the XML parser. See e.g. https://try.jsoup.org/~Qgdx_A13CctCvLA1C4WZRNhpJ-c
Also, best to use StackOverflow for Q&A; we use GitHub Issues for issue tracking.
sorry about that,I can’t open StackOverflow,because google is forbidden for me,and I can‘t find a anwser from the other search engines. fortunately,I found a solution
org.jsoup.nodes.Document document = Jsoup.parse(originalHtmlTemplate);
document.outputSettings().syntax(org.jsoup.nodes.Document.OutputSettings.Syntax.xml);
document.outputSettings().escapeMode(Entities.EscapeMode.xhtml);
thanks a lot
@WayneLee5991 sorry, I hadn't considered that Google or StackOverflow may be blocked or partially accessible. Glad you found the fix. I'll have a think about copying the common StackOverflow jsoup FAQs over to the jsoup.org documentation site. Do you think that would be useful?
@WayneLee5991 sorry, I hadn't considered that Google or StackOverflow may be blocked or partially accessible. Glad you found the fix. I'll have a think about copying the common StackOverflow jsoup FAQs over to the jsoup.org documentation site. Do you think that would be useful? It could‘t be better,you also can put some FAQs in the README.