UNPKG

typesxml

Version:

Open source XML library written in TypeScript

37 lines 1.43 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 { SchemaParticle } from './SchemaParticle.js'; export class SchemaSequence extends 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); } } //# sourceMappingURL=SchemaSequence.js.map