stringify
import { stringify } from "jsr:@ende/xml";function
function stringify(node: XmlDocument | XmlElement, options?: StringifyOptions): stringConverts an XML document or element to an XML string.
node: XmlDocument | XmlElementThe document or element to serialize.
options?: StringifyOptionsOptions for configuring the serialization.
Returns
The serialized XML string.
Example: Usage
import { stringify } from "@ende/xml/stringify";
import { assertEquals } from "@ende/assert";
const element = {
type: "element" as const,
name: { raw: "root", local: "root" },
attributes: {},
children: [{ type: "text" as const, text: "Hello!" }],
};
assertEquals(stringify(element), "<root>Hello!</root>");