Sample code for 30+ languages & platforms
JavaScript

Convert HTML File to XML File

See more HTML-to-XML/Text Examples

Convert HTML file to XML file.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
var success = false;

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

var htmlToXml = new CkHtmlToXml();

// Indicate the charset of the output XML we'll want.
htmlToXml.XmlCharset = "utf-8";

success = htmlToXml.ConvertFile("test.html","out.xml");
if (success !== true) {
    console.log(htmlToXml.LastErrorText);
}
else {
    console.log("Success");
}