export type Attribute = { name: string; value: string; }; export type OpenTagEvent = { type: 'openTag'; name: string; attributes: Record; }; export type CloseTagEvent = { type: 'closeTag'; name: string; }; export type TextEvent = { type: 'text'; content: string; }; export type XMLEvent = OpenTagEvent | CloseTagEvent | TextEvent; export type XMLEventHandlers = { onOpenTag: (event: OpenTagEvent) => void; onCloseTag: (event: CloseTagEvent) => void; onText: (event: TextEvent) => void; }; /** * A simple streaming XML parser that handles partial chunks * and emits events without buffering text */ export declare class StreamingXMLParser { private state; private buffer; private currentTag; private attributes; private handlers; private whitelist; private closed; constructor({ handlers, whitelist }: { handlers: Partial; whitelist?: string[]; }); /** * Process a chunk of XML text */ write(chunk: string): void; /** * Process individual characters */ private processChar; private processTextState; private processTagStartState; private failWhitelistProgress; private failWhitelist; private processOpeningTagState; private processClosingTagState; /** * Close the parser, handling any remaining buffered content */ close(): void; private emitText; private emitOpenTag; private emitCloseTag; private isWhitespace; private isValidTagNameChar; /** * Helper to emit text content and reset parser state to TEXT mode */ private emitTextAndReset; } export declare function openTag(tag: string, attrs?: Record): string; export declare function closeTag(tag: string): string; export declare function tagged(tag: string, attrs?: Record, ...content: string[]): string;