import type { XmlNode } from './tree'; export interface XmlStreamWriterOptions { /** Map of namespace URI → prefix. Merged on top of DEFAULT_PREFIXES. */ prefixMap?: Readonly>; /** Emit `` declaration first. Defaults to true. */ xmlDeclaration?: boolean; /** `standalone` attribute on the declaration. Defaults to 'yes'. */ standalone?: 'yes' | 'no' | 'omit'; /** * Auto-flush threshold in bytes. Once the in-flight string buffer crosses * this size it gets encoded into a chunk and parked. Larger values trade * memory for fewer TextEncoder calls; smaller values lower peak memory at the * cost of CPU. */ flushBytes?: number; } export interface XmlStreamWriter { /** * Open an element. Names are in Clark notation (`{ns}local`); the writer * prefixes them via the configured prefix map. */ start(name: string, attrs?: Record): void; /** Emit a text node inside the currently open element. */ text(s: string): void; /** Emit a complete subtree. Closes any pending start tag first. */ writeNode(n: XmlNode): void; /** Emit pre-rendered XML bytes verbatim — escape-hatch for hot paths. */ writeRaw(s: string): void; /** Close the currently open element (matched against the start stack). */ end(): void; /** Force any buffered bytes into the chunk store immediately. */ flush(): void; /** * Materialise everything written so far. Throws if any element is still open. * Idempotent. */ result(): Uint8Array; } export declare function createXmlStreamWriter(opts?: XmlStreamWriterOptions): XmlStreamWriter;