partial-xml-stream-parser
Version:
A lenient XML stream parser for Node.js and browsers that can handle incomplete or malformed XML data, with depth control, CDATA support for XML serialization and round-trip parsing, wildcard pattern support for stopNodes, and CDATA handling within stopNo
36 lines • 1.31 kB
TypeScript
import { xmlObjectToString } from "./src/utils";
import { ParserContext, ParserOptions, ParseResult } from "./src/types";
export declare class PartialXMLStreamParser implements ParserContext {
customOptions: Required<ParserOptions>;
allowedRootNodes: Set<string> | null;
attrRegex: RegExp;
commentRegex: RegExp;
cdataOpenRegex: RegExp;
doctypeRegex: RegExp;
xmlDeclRegex: RegExp;
stopNodeRegexCache: Record<string, RegExp>;
simpleStopNodes: Set<string>;
pathStopNodes: Set<string>;
streamingBuffer: string;
_activelyStreaming: boolean;
accumulator: any[];
currentPointer: any;
tagStack: any[];
parsingIndex: number;
incompleteStructureState: any;
reparsedSegmentContext: any;
streamingBufferBeforeClear: string;
_originalBufferHadContent: boolean;
_lastClearedIncompleteStateWasSpecial: boolean;
_rootDeterminationBuffer: string;
_plainTextAccumulator: string;
_treatAsPlainText: boolean;
_initialSegmentTypeDecided: boolean;
constructor(options?: Partial<ParserOptions>);
reset(): void;
private _processBuffer;
parseStream(xmlChunk: string | Buffer | null | undefined): ParseResult;
}
export { xmlObjectToString };
export type { ParserOptions, ParseResult };
//# sourceMappingURL=index.d.ts.map