Java
Chilkat2 Java
Convert HTML File to XML File
See more HTML-to-XML/Text Examples
Convert HTML file to XML file.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.HtmlToXml;
public class ChilkatExample {
public static void main(String[] args) {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
HtmlToXml htmlToXml = new HtmlToXml();
// Indicate the charset of the output XML we'll want.
htmlToXml.setXmlCharset("utf-8");
try {
htmlToXml.convertFile("test.html", "out.xml");
System.out.println("Success");
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
}
}
}