import { DOMImplementation } from "@xmldom/xmldom";
import { toJson } from "libxmq";
const doc = new DOMImplementation().createDocument(null, "request", null);
const request = doc.documentElement!;
const id = doc.createElement("id");
id.setAttribute("S", "");
id.appendChild(doc.createTextNode("123"));
request.appendChild(id);
const names = doc.createElement("names");
names.setAttribute("A", "");
for (const name of ["samuel", "isildur"])
{
const n = doc.createElement("_");
n.appendChild(doc.createTextNode(name));
names.appendChild(n);
}
request.appendChild(names);
console.log(JSON.stringify(toJson(doc)));