UNPKG

typesxml

Version:

Open source XML library written in TypeScript

132 lines 3.44 kB
"use strict"; /******************************************************************************* * Copyright (c) 2023-2026 Maxprograms. * * This program and the accompanying materials * are made available under the terms of the Eclipse 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 *******************************************************************************/ Object.defineProperty(exports, "__esModule", { value: true }); exports.JsonEventCollector = void 0; class JsonEventCollector { events; catalog; grammar; constructor() { this.events = new Array(); } initialize() { this.events = new Array(); } setCatalog(catalog) { this.catalog = catalog; } setGrammar(grammar) { this.grammar = grammar; } getGrammar() { return this.grammar; } getCurrentText() { return ''; } getEvents() { return this.events; } startDocument() { this.events.push({ type: "startDocument" }); } endDocument() { this.events.push({ type: "endDocument" }); } xmlDeclaration(version, encoding, standalone) { this.events.push({ type: "xmlDeclaration", version: version, encoding: encoding, standalone: standalone }); } startElement(name, atts) { const attributes = new Array(); for (let index = 0; index < atts.length; index++) { const attribute = atts[index]; const descriptor = { name: attribute.getName(), value: attribute.getValue() }; attributes.push(descriptor); } this.events.push({ type: "startElement", name: name, attributes: attributes }); } endElement(name) { this.events.push({ type: "endElement", name: name }); } internalSubset(declaration) { this.events.push({ type: "internalSubset", declaration: declaration }); } characters(ch) { this.events.push({ type: "characters", value: ch }); } ignorableWhitespace(ch) { this.events.push({ type: "ignorableWhitespace", value: ch }); } comment(ch) { this.events.push({ type: "comment", value: ch }); } processingInstruction(target, data) { this.events.push({ type: "processingInstruction", target: target, data: data }); } startCDATA() { this.events.push({ type: "startCDATA" }); } endCDATA() { this.events.push({ type: "endCDATA" }); } startDTD(name, publicId, systemId) { this.events.push({ type: "startDTD", name: name, publicId: publicId, systemId: systemId }); } endDTD() { this.events.push({ type: "endDTD" }); } skippedEntity(name) { this.events.push({ type: "skippedEntity", name: name }); } } exports.JsonEventCollector = JsonEventCollector; //# sourceMappingURL=JsonEventCollector.js.map