Sample code for 30+ languages & platforms
Lua

Convert HTML File to XML File

See more HTML-to-XML/Text Examples

Convert HTML file to XML file.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

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

local htmlToXml = chilkat.HtmlToXml.new()

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

local success = htmlToXml:convert_file("test.html", "out.xml")
if not success then
    print(htmlToXml.last_error_text)
else
    print("Success")
end