UNPKG

typesxml

Version:

Open source XML library written in TypeScript

41 lines 1.59 kB
"use strict"; /******************************************************************************* * 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 *******************************************************************************/ Object.defineProperty(exports, "__esModule", { value: true }); exports.SchemaSequence = void 0; const SchemaParticle_js_1 = require("./SchemaParticle.js"); class SchemaSequence extends SchemaParticle_js_1.SchemaParticle { particles; constructor(particles, minOccurs = 1, maxOccurs = 1) { super(minOccurs, maxOccurs); this.particles = particles; } matchOnce(children, pos, nsMap, childNamespaces) { let positions = new Set([pos]); for (const particle of this.particles) { const nextPositions = new Set(); for (const p of positions) { const matched = particle.matchRepeated(children, p, nsMap, childNamespaces); for (const m of matched) { nextPositions.add(m); } } positions = nextPositions; if (positions.size === 0) { break; } } return Array.from(positions); } } exports.SchemaSequence = SchemaSequence; //# sourceMappingURL=SchemaSequence.js.map