Zig
Zig
Decode HTML Entities found in XML
Demonstrates how to decode HTML entities found in XML.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
// Load an XML file containing the following:
// <?xml version="1.0" encoding="UTF-8"?>
// <output>Französische</output>
const xml = try chilkat.Xml.init();
defer xml.deinit();
try xml.loadXmlFile("qa_data/xml/hasHtmlEntity.xml");
// Get non-decoded content, then get decoded content.
// Result is Französische
std.debug.print("{s}\n", .{try xml.getContent(alloc)});
// Result is Französische
const str_decoded = try xml.decodeEntities(alloc, try xml.getContent(alloc));
std.debug.print("{s}\n", .{str_decoded});
}