import org.w3c.tidy.Tidy; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class HTMLtoXHTMLConverter { public static void main(String[] args) { String htmlFile = "path/to/input.html"; String xhtmlFile = "path/to/output.xhtml"; Tidy tidy = new Tidy(); tidy.setXHTML(true); tidy.setQuiet(true); tidy.setShowWarnings(false); try { FileInputStream fis = new FileInputStream(htmlFile); FileOutputStream fos = new FileOutputStream(xhtmlFile); tidy.parse(fis, fos); fis.close(); fos.close(); System.out.println("HTML to XHTML conversion completed successfully!"); } catch (IOException e) { e.printStackTrace(); } } }


上一篇:
下一篇:
切换中文