UNPKG

typesxml

Version:

Open source XML library written in TypeScript

81 lines (80 loc) 3.47 kB
/******************************************************************************* * Copyright (c) 2023-2026 Maxprograms. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 1.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/org/documents/epl-v10.html * * Contributors: * Maxprograms - initial API and implementation *******************************************************************************/ import { Catalog } from "../Catalog.js"; import { AttListDecl } from "./AttListDecl.js"; import { DTDGrammar } from "./DTDGrammar.js"; import { ElementDecl } from "./ElementDecl.js"; import { EntityDecl } from "./EntityDecl.js"; import { NotationDecl } from "./NotationDecl.js"; export declare class DTDParser { private grammar; private catalog; private pointer; private source; private currentFile; private baseDirectory; private validating; private overrideExistingDeclarations; private preexistingEntityKeys; private preexistingAttributeKeys; private unresolvedExternalEntities; private parsingInternalSubset; private xmlVersion; private openConditionalSections; constructor(grammar?: DTDGrammar, baseDirectory?: string); setGrammar(grammar: DTDGrammar): void; setOverrideExistingDeclarations(override: boolean): void; setValidating(validating: boolean): void; setCatalog(catalog: Catalog): void; setXmlVersion(version: string): void; parseDTD(file: string): DTDGrammar; parseFile(file: string): DTDGrammar; parseString(source: string): DTDGrammar; parse(): DTDGrammar; importAllEntities(sourceGrammar: DTDGrammar, targetGrammar: DTDGrammar): void; extractAndImportEntities(filePath: string): void; private readFileContent; endConditionalSection(): void; parseConditionalSection(): void; skipIgnoreSection(): void; resolveEntities(fragment: string, depth?: number): string; parseEntityDeclaration(declaration: string): EntityDecl; private attachUnresolvedError; private normalizeEntityLiteral; private validateParameterEntityValue; private ensureParameterReferenceSyntax; private validateParsedEntityValue; private ensureGeneralEntityDelimitersBalanced; private decodeCharacterReferencesForValidation; parseNotationDeclaration(declaration: string): NotationDecl; parseAttributesListDeclaration(declaration: string): AttListDecl; parseElementDeclaration(declaration: string): ElementDecl; lookingAt(text: string): boolean; findDeclarationEnd(startPointer: number): number; resolveEntity(publicId: string, systemId: string): string; makeAbsolute(uri: string): string; loadExternalEntity(publicId: string, systemId: string, isReferenced?: boolean, entityName?: string, isParameterEntity?: boolean): string; private validateTextContent; private removeTextDeclaration; expandParameterEntities(text: string): string; private containsParameterEntityReference; private validateAttributeDefaultEntities; private isPredefinedGeneralEntity; private requireWhitespaceAfterKeyword; private hasParameterEntityReferenceOutsideLiterals; private readParameterEntityReference; private needsSeparatorBefore; private needsSeparatorAfter; private isMarkupDelimiter; private findParameterEntityReferences; getGrammar(): DTDGrammar; }