how can we convert html to well formed xhtml by using Http class api,if possible please give a demonstration code....thanks
HTML is the standard markup language for creating web pages, while XHTML is a stricter and more standardized version of HTML. Both HTML and XHTML include a wide range of features, such as support for multimedia, styling, and scripting.
Find and select the JAVA files on your computer and click Open to bring them into Doxillion to convert them to the HTML file format. You can also drag and drop your JAVA files directly into the program to convert them as well.
I just did it using Jsoup, if it works for you:
private String htmlToXhtml(final String html) {
final Document document = Jsoup.parse(html);
document.outputSettings().syntax(Document.OutputSettings.Syntax.xml);
return document.html();
}
Some useful content where my solution came from:
Have a look at J-Tidy: http://jtidy.sourceforge.net/ It usually does a quite good job cleaning up messy html and converting it to xhtml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With