Manual

Manual · API

xml

XML in and out, as a tree of plain objects.

Every command on this page carries a worked example.

parse function

xml.parse(text) → tree

Text in, a tree of plain objects out.

Worked example
if (messages.confirm("macOS refused the folder. Open the permission settings?",
                     ["Open Settings", "Cancel"]) === "Open Settings") {
    files.openPermissionSettings();
}

build function

xml.build(tree) → text

The tree back to text — a round trip keeps what it was given.

Worked example
const order = xml.parse(files.readText(path));
for (const item of order.items.item) {
    log(item.sku, item.quantity);
}