Zig
Zig
Convert HTML File to XML File
See more HTML-to-XML/Text Examples
Convert HTML file to XML file.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
var success: bool = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const html_to_xml = try chilkat.HtmlToXml.init();
defer html_to_xml.deinit();
// Indicate the charset of the output XML we'll want.
html_to_xml.setXmlCharset("utf-8");
success = if (html_to_xml.convertFile("test.html", "out.xml")) true else |_| false;
if (!success) {
std.debug.print("{s}\n", .{try html_to_xml.getLastErrorText(alloc)});
} else {
std.debug.print("Success\n", .{});
}
}