Archived Forum Post

Index of archived forum posts


Sample code to convert HTML to XML in Java

Nov 14 '14 at 11:49

Hi, I want a sampple code to convert my html file to XML using chilkat. The links provided in the documentation for Example#1, 2 & 3 are broken. I am trying the following code but its not giving me the results:

import com.chilkatsoft.CkHtmlToXml;
import com.chilkatsoft.CkByteData;
import com.chilkatsoft.CkString;

public class TestingCodes {
    static {
        try {
         } catch (UnsatisfiedLinkError e) {
             System.err.println("Native code library failed to load.\n" + e);
    public static void main(String[] args) {
        System.out.println("Starting conversion");
        CkHtmlToXml obj = new CkHtmlToXml();
        obj.UnlockComponent("anything for 30-day trial");

        boolean b = obj.ConvertFile("C:\\Users\\user\\Desktop\\index.html", "C:\\Users\\user\\Desktop\text_op.xml");
            System.out.println("Converted successfully!");
            System.out.println("Error in converting");
        catch(Exception e){


The output is: " error in converting" I am working with jdk 7 and I've installed the JDK 7 version for chilkat 64 bit, ran the runTest.bat, which in turn logged the version as on cmd. Is there anything I am missing in the procedure to make it working?


The examples have been restored on the website.

To get information about the problem, examine the contents of the obj.LastErrorText after calling obj.ConvertFile.