Java tutorial
//package com.java2s; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class Main { public static String toXHTML(String html) { html = html.replaceAll("(?s)<script>.*?</script>", "<!-- removed scripts --!>"); final Document document = Jsoup.parse(html); document.outputSettings().syntax(Document.OutputSettings.Syntax.xml); return document.html(); } }