/** * SaxInstrumentation (G1-prep — v1.5.0) * * v1.7.0 performance: * • buildPath() memoized incrementally — O(segment) per push instead of * O(full-depth) map+join on every open AND close event. * • `namespaceStack` on close hints reuses the same array reference — no * `[...currentNs]` spread allocation (close hints are read-only after emit). * • Attribute map allocated lazily — only when `ev.attributes` is non-empty. * • `sibCounts` Map allocated lazily — only for elements that actually have * siblings (most elements in practice have none or one sibling). * • `newNs` array cloned only when new namespace declarations are present on * the element; otherwise shares the parent array reference. */ import { SaxParser } from './SaxParser'; /** A snapshot of the namespace scope at a given element boundary. */ export interface NamespaceFrame { prefix: string; namespaceURI: string; } /** Structured hint emitted for every start-element and end-element event. */ export interface SaxValidationHint { kind: 'open' | 'close'; qualifiedName: string; localName: string; namespaceURI: string; depth: number; namespaceStack: NamespaceFrame[]; attributes?: Record; line: number; col: number; path: string; } export interface SaxEventConsumer { onHint(hint: SaxValidationHint): void; onEnd?(hadError: boolean): void; onError?(err: Error): void; } export declare function instrumentSax(parser: SaxParser, consumer: SaxEventConsumer): SaxParser; export declare function createInstrumentedSax(xml: string, consumer: SaxEventConsumer): SaxParser; export declare function collectSaxHints(xml: string): SaxValidationHint[]; //# sourceMappingURL=SaxInstrumentation.d.ts.map