import { PDFRawStream } from '../../../plugins.js'; /** * Base class for PDF XML extractors with common functionality */ export declare abstract class BaseXMLExtractor { /** * Known XML file names for different invoice formats */ protected readonly knownFileNames: string[]; /** * Known XML formats to validate extracted content */ protected readonly knownFormats: string[]; /** * Known XML end tags for extracting content from strings */ protected readonly knownEndTags: string[]; /** * Extract XML from a PDF buffer * @param pdfBuffer PDF buffer * @returns XML content or null if not found */ abstract extractXml(pdfBuffer: Uint8Array | Buffer): Promise; /** * Check if an XML string is valid * @param xmlString XML string to check * @returns True if the XML is valid */ protected isValidXml(xmlString: string): boolean; /** * Check if the XML string contains a known element * @param xmlString XML string to check * @returns True if the XML contains a known element */ protected hasKnownXmlElement(xmlString: string): boolean; /** * Check if the XML string contains a known format * @param xmlString XML string to check * @returns True if the XML contains a known format */ protected hasKnownFormat(xmlString: string): boolean; /** * Check if the XML string has a proper structure * @param xmlString XML string to check * @returns True if the XML has a proper structure */ protected hasProperXmlStructure(xmlString: string): boolean; /** * Check if the XML string contains binary data * @param xmlString XML string to check * @returns True if the XML contains binary data */ protected hasBinaryData(xmlString: string): boolean; /** * Extract XML from a string * @param text Text to extract XML from * @param startIndex Index to start extraction from * @returns XML content or null if not found */ protected extractXmlFromString(text: string, startIndex?: number): string | null; /** * Decompress and decode XML content from a PDF stream * @param stream PDF stream containing XML data * @param fileName Name of the file (for logging) * @returns XML content or null if not valid */ protected extractXmlFromStream(stream: PDFRawStream, fileName: string): Promise; /** * Try to decompress a buffer using different methods * @param buffer Buffer to decompress * @returns Decompressed buffer or null if decompression failed */ protected tryDecompress(buffer: Uint8Array): Uint8Array | null; /** * Try to decode a buffer to a string using different encodings * @param buffer Buffer to decode * @returns Decoded string or null if decoding failed */ protected tryDecodeBuffer(buffer: Uint8Array): string | null; /** * Decode a buffer using ISO-8859-1 (Latin1) encoding * @param buffer Buffer to decode * @returns Decoded string */ protected decodeLatin1(buffer: Uint8Array): string; /** * Check if a string is plausibly XML (quick check before validation) * @param content String to check * @returns True if the string is plausibly XML */ protected isPlausibleXml(content: string): boolean; }