Sample code for 30+ languages & platforms
Swift

Convert HTML File to XML File

See more HTML-to-XML/Text Examples

Convert HTML file to XML file.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

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

    let htmlToXml = CkoHtmlToXml()!

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

    success = htmlToXml.convertFile(inHtmlPath: "test.html", destXmlPath: "out.xml")
    if success != true {
        print("\(htmlToXml.lastErrorText!)")
    }
    else {
        print("Success")
    }


}