/** * XmlStreamWriter - True Streaming XML Writer * * Writes XML directly to a {@link WritableTarget} without buffering * the entire document in memory. This is the correct solution for * large XML output (e.g. worksheets with hundreds of thousands of rows). * * Implements the same {@link XmlSink} interface as {@link XmlWriter}, * so rendering code can target either backend transparently. */ import type { WritableTarget, XmlAttributes, XmlSink } from "./types.js"; /** * Streaming XML writer that flushes content directly to a writable target. * * Unlike {@link XmlWriter}, this class never holds the full XML in memory. * Each method call immediately writes its output to the target. * * **Trade-off**: No rollback support. Once written, content cannot be undone. * Use {@link XmlWriter} if you need speculative/transactional writes. * * @example * ```ts * const chunks: string[] = []; * const target = { write(chunk: string) { chunks.push(chunk); } }; * const sw = new XmlStreamWriter(target); * sw.openXml(); * sw.openNode("root"); * sw.leafNode("item", { id: "1" }, "hello"); * sw.closeNode(); * console.log(chunks.join("")); * ``` */ declare class XmlStreamWriter implements XmlSink { private _target; private _stack; private _leaf; private _open; private _pending; constructor(target: WritableTarget); /** Current nesting depth. */ get depth(): number; /** Name of the innermost open element, or undefined. */ get currentElement(): string | undefined; /** Flush the pending start-tag buffer with a closing character. */ private _flushOpen; openXml(attributes?: XmlAttributes): void; openNode(name: string, attributes?: XmlAttributes): void; addAttribute(name: string, value: string | number | boolean): void; addAttributes(attributes: XmlAttributes): void; writeText(text: string | number): void; writeRaw(xml: string): void; writeCData(text: string): void; writeComment(text: string): void; closeNode(): void; leafNode(name: string, attributes?: XmlAttributes, text?: string | number): void; /** Close all open elements. */ closeAll(): void; } export { XmlStreamWriter };