UNPKG

typesxml

Version:

Open source XML library written in TypeScript

34 lines 1.34 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.SchemaChoice = void 0; const SchemaParticle_js_1 = require("./SchemaParticle.js"); class SchemaChoice extends SchemaParticle_js_1.SchemaParticle { particles; constructor(particles, minOccurs = 1, maxOccurs = 1) { super(minOccurs, maxOccurs); this.particles = particles; } matchOnce(children, pos, nsMap, childNamespaces) { const results = new Set(); for (const particle of this.particles) { const matched = particle.matchRepeated(children, pos, nsMap, childNamespaces); for (const p of matched) { results.add(p); } } return Array.from(results); } } exports.SchemaChoice = SchemaChoice; //# sourceMappingURL=SchemaChoice.js.map