Sample code for 30+ languages & platforms
Zig

Setting XML Tag and Content

See more XML Examples

Demonstrates how to set the tag and content of an XML node.

The following XML sample code produces this output:


<abc>123</abc>

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    const xml = try chilkat.Xml.init();
    defer xml.deinit();

    xml.setTag("abc");
    xml.setContent("123");

    std.debug.print("{s}\n", .{try xml.getXml(alloc)});
}