java - Is it possible to convert HTML into XHTML with Jsoup 1.8.1? -


string body = "<br>"; document document = jsoup.parsebodyfragment(body); document.outputsettings().escapemode(escapemode.xhtml); string str = document.body().html(); system.out.println(str); 

expect: <br />

result: <br>

can jsoup convert value html xhtml?

see document.outputsettings.syntax.xml:

private string toxhtml( string html ) {     final document document = jsoup.parse(html);     document.outputsettings().syntax(document.outputsettings.syntax.xml);         return document.html(); } 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

Simple Angular 2 project fails 'Unexpected reserved word' -

ios - Possible to get UIButton sizeThatFits to work? -