/* libxmq - Copyright (C) 2026 Fredrik Öhrström (spdx: MIT) */ // Build a small document with the W3C DOM and print it as compact xmq. import { DOMImplementation } from "@xmldom/xmldom"; import { print } from "libxmq"; // Node has no DOM of its own, @xmldom/xmldom gives one. In a browser use // document.implementation instead. const doc = new DOMImplementation().createDocument(null, "greeting", null); const greeting = doc.documentElement!; // A key value, hello = world, is an element with a text. const hello = doc.createElement("hello"); hello.appendChild(doc.createTextNode("world")); greeting.appendChild(hello); console.log(print(doc, { compact: true }));