PureXML/Sources/Schema
Mihaela Mihaljevic fa3552876a fix(schema): saturate effectively-unbounded content-model counters (#192, partial)
The counted content-model automaton represents its active set as
(state, counter-vector) configurations bounded by states times the product of
the per-counter saturation caps. An unbounded counter already saturates at its
minimum (every higher count is matching-equivalent). A finite maximum the input
cannot reach is equivalent: the active set increments a counter at most to its
cap, the cap is at most inputLength+1, so when maximum > inputLength+1 the value
can never reach maximum, belowMaximum is always satisfied, and every value at or
above the minimum is indistinguishable. Saturate such a counter at its minimum
too, so a huge but finite maxOccurs on a nested counter no longer multiplies the
active set by an inputLength factor per nesting level.

A document that did not terminate within a minute against the Z035 worst case
(nested sequences/choices with maxOccurs up to 1e11) now validates in linear
time. No accept/reject decision changes: the full XSTS suite holds at
0/35/0/26, and an adversarial no-caps reference-matcher differential found no
false positive or false negative, including the nullable-body case (where the
builder makes canExit unconditional, so the counter value is matching-irrelevant)
and the occurrence boundary. Guarded by ContentMatcherWorstCaseTests.

Partial: a model with several moderate (input-reachable) maxOccurs nested deeply
still enumerates a large active set; the general polynomial bound (a position-
indexed DP over the counting automaton) remains under #192.
2026-06-21 13:16:24 +02:00
..
BuiltinType.swift fix(schema): compare identity-constraint fields across the decimal value space; invalid-instances-accepted 95 to 94 (#147) 2026-06-18 11:01:05 +02:00
ComplexType.swift fix(schema): count content-model occurrences 2026-06-19 23:32:04 +02:00
ComplexValidator.swift fix(schema): compare simpleContent fixed value in value space 2026-06-20 18:08:32 +02:00
ComplexValidatorAttributes.swift fix(schema): exclude use="prohibited" attributes from effective uses at instance time; invalid-instances-accepted 43 to 39 (#147) 2026-06-18 15:28:35 +02:00
ComplexValidatorContentModel.swift fix(schema): count content-model occurrences 2026-06-19 23:32:04 +02:00
ComplexValidatorDerivation.swift fix(schema): reject xsi:type=anyType on an anySimpleType-declared element 2026-06-20 02:09:51 +02:00
ComplexValidatorHelpers.swift fix(schema): streaming validator applies default/fixed value constraints 2026-06-20 17:38:45 +02:00
ComplexValidatorIDs.swift fix(schema): enforce document-scoped xs:ID uniqueness and xs:IDREF resolution 2026-06-13 19:17:34 +02:00
ComplexValidatorStreaming.swift fix(schema): compare simpleContent fixed value in value space 2026-06-20 18:08:32 +02:00
ComplexValidatorXSIType.swift fix(schema): advance XSTS valid-instances-rejected to 4 (#146) 2026-06-16 22:22:05 +02:00
ContentMatcher.swift fix(schema): saturate effectively-unbounded content-model counters (#192, partial) 2026-06-21 13:16:24 +02:00
ContentModelDeterminism.swift feat(schema): enforce Unique Particle Attribution (cos-nonambig) 2026-06-14 09:35:33 +02:00
ContentNFABuilder.swift fix(schema): count content-model occurrences 2026-06-19 23:32:04 +02:00
DateTimeParser.swift fix(schema): reject year 0000 in dateTime, date, gYearMonth, gYear 2026-06-20 01:31:14 +02:00
DateTimeValue.swift feat(schema): XSD simple-type datatype library with facets 2026-06-08 06:29:37 +02:00
DecimalValue.swift feat(schema): XSD simple-type datatype library with facets 2026-06-08 06:29:37 +02:00
DerivationMethod.swift feat(schema): XSD derivation control (abstract, block, final, redefine) 2026-06-08 14:14:23 +02:00
DurationValue.swift style(schema): drop vestigial day clamp in DurationValue.instant 2026-06-13 18:04:25 +02:00
IdentityConstraint.swift fix(schema): resolve identity-constraint XPath prefixes against the schema (#147) 2026-06-17 00:03:13 +02:00
IdentityFieldValue.swift fix(schema): default/fixed value for identity-constraint fields; invalid-instances-accepted 50 to 45 (#147) 2026-06-18 14:47:47 +02:00
IdentityValidator.swift fix(schema): default/fixed value for identity-constraint fields; invalid-instances-accepted 50 to 45 (#147) 2026-06-18 14:47:47 +02:00
IdentityValidatorDefaults.swift fix(schema): default/fixed value for identity-constraint fields; invalid-instances-accepted 50 to 45 (#147) 2026-06-18 14:47:47 +02:00
IDTracker.swift fix(schema): enforce document-scoped xs:ID uniqueness and xs:IDREF resolution 2026-06-13 19:17:34 +02:00
Lexical.swift feat(schema): XSD simple-type datatype library with facets 2026-06-08 06:29:37 +02:00
OccurrenceRange.swift fix(schema): count content-model occurrences 2026-06-19 23:32:04 +02:00
ParticleNormalization.swift fix(schema): normalize content model, scope occurrence subsumption in particle restriction 2026-06-14 17:18:38 +02:00
ParticleRestriction.swift fix(schema): eliminate the last false positive (particlesZ001); false-positives = 0 (#148) 2026-06-17 19:56:57 +02:00
ParticleRestrictionElement.swift fix(schema): restriction may not narrow an element to an extension-derived type 2026-06-20 18:34:50 +02:00
ParticleRestrictionHelpers.swift fix(schema): eliminate the last false positive (particlesZ001); false-positives = 0 (#148) 2026-06-17 19:56:57 +02:00
Primitive.swift fix(schema): validate notation declarations and enumeration restrictions 2026-06-15 22:27:04 +02:00
RelaxNGCompactHelpers.swift feat(relaxng): fold RNC ~ string concatenation 2026-06-08 17:38:58 +02:00
RelaxNGCompactLexer.swift feat(relaxng): add compact syntax (RNC) and include/externalRef 2026-06-08 09:13:09 +02:00
RelaxNGCompactParser.swift feat(relaxng): skip RNC >> follow-annotations, completing #79 2026-06-09 03:20:47 +02:00
RelaxNGContentType.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGDerivative.swift feat(relaxng): QName values with dual-context resolution, instance level clean 2026-06-10 10:57:14 +02:00
RelaxNGDiagnostics.swift feat(relaxng): distinguish undeclared attribute from invalid value 2026-06-09 01:11:54 +02:00
RelaxNGFacets.swift fix(schema): advance XSTS valid-instances-rejected to 4 (#146) 2026-06-16 22:22:05 +02:00
RelaxNGGrammarCheck.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGGrammarCheckSections.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGNameClasses.swift feat(relaxng): ns inheritance, QNames, include-start, combine, data-except 2026-06-10 10:24:46 +02:00
RelaxNGNode.swift feat(relaxng): grammar scoping, parentRef, include overrides, div flattening 2026-06-10 10:34:44 +02:00
RelaxNGParser.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGParserIncludes.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGPattern.swift feat(relaxng): QName values with dual-context resolution, instance level clean 2026-06-10 10:57:14 +02:00
RelaxNGRestrictionChecker.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGRestrictionOverlap.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGRestrictionPaths.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGRestrictions.swift feat(relaxng): schema-correctness validation, spec suite complete 2026-06-10 11:38:45 +02:00
RelaxNGSchema.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
SchemaAllGroupPlacement.swift fix(schema): reject an all-group referenced inside a compositor (cos-all-limited) 2026-06-15 12:38:30 +02:00
SchemaAttributeApplicability.swift fix(schema): a local element must have a name or a ref; invalid-schemas-accepted 80 to 79 (#145) 2026-06-18 00:34:50 +02:00
SchemaAttributeRestriction.swift fix(schema): a restriction's attribute wildcard must subset the base's (#145) 2026-06-17 18:46:04 +02:00
SchemaAttributeUniqueness.swift fix(schema): an attribute's type must be a simple type (au-props-correct); invalid-schemas-accepted 96 to 95 (#145) 2026-06-17 22:12:01 +02:00
SchemaCompileValidation.swift fix(schema): forbid attribute declarations in the XSI namespace 2026-06-20 14:33:14 +02:00
SchemaCompositionValidations.swift fix(schema): enforce model-group redefine restriction (cos-group-restrict) 2026-06-18 18:24:58 +02:00
SchemaContentOrder.swift fix(schema): require a content derivation in simpleContent/complexContent (#145) 2026-06-17 14:58:58 +02:00
SchemaDerivationControl.swift feat(schema): key the instance derivation/substitution backbone by namespaced identity; re-land blockDefault; invalid-instances-accepted 89 to 81 (#186, #147) 2026-06-18 12:41:18 +02:00
SchemaDocument.swift fix(schema): default/fixed value for identity-constraint fields; invalid-instances-accepted 50 to 45 (#147) 2026-06-18 14:47:47 +02:00
SchemaDocumentHints.swift fix(schema): default/fixed value for identity-constraint fields; invalid-instances-accepted 50 to 45 (#147) 2026-06-18 14:47:47 +02:00
SchemaExtensionAllGroup.swift Reject mixedness-changing complexContent extensions 2026-06-18 22:37:49 +02:00
SchemaFacetApplicability.swift fix(schema): reject a constraining facet on anySimpleType-based simpleContent 2026-06-18 19:27:28 +02:00
SchemaIDAttribute.swift feat(schema): locate compile diagnostics with validation coding paths (#169) 2026-06-16 10:26:11 +02:00
SchemaIdentityXPath.swift fix(schema): an identity-constraint xpath may not use an undeclared prefix; invalid-schemas-accepted 77 to 75 (#145) 2026-06-18 01:01:12 +02:00
SchemaIDValueConstraint.swift fix(schema): an ID-derived attribute or element may not have a value constraint 2026-06-15 11:41:26 +02:00
SchemaImportNamespace.swift fix(schema): a redefined type must derive from itself, not a same-named foreign type (src-redefine.5); invalid-schemas-accepted 84 to 81 (#161) 2026-06-17 23:00:07 +02:00
SchemaNameUniqueness.swift fix(schema): a redefined schema's targetNamespace must match the redefiner (src-redefine); invalid-schemas-accepted 74 to 71 (#161) 2026-06-18 01:25:34 +02:00
SchemaNestedDefinition.swift feat(schema): a nested simpleType or attributeGroup may not be named (localSimpleType) 2026-06-15 15:41:48 +02:00
SchemaNotationValidity.swift fix(schema): hold xsd:notation to its (annotation?) content model (#145) 2026-06-17 14:17:27 +02:00
SchemaRedefineSelfReference.swift refactor(schema): extract shared base-component resolution for redefines 2026-06-18 20:20:26 +02:00
SchemaReferenceForeignPools.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
SchemaReferenceResolution.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
SchemaReferences.swift fix(schema): reject references into never-imported namespaces 2026-06-20 13:50:55 +02:00
SchemaSimpleTypeFinal.swift fix(schema): inherit finalDefault as a simple type's final (#145) 2026-06-17 13:59:19 +02:00
SchemaSimpleTypeValidity.swift fix(schema): require a list or union to declare its member types (#145) 2026-06-17 14:11:26 +02:00
SchemaStructure.swift fix(schema): a reference to an all group must have maxOccurs 1 2026-06-20 19:14:33 +02:00
SchemaStructureHelpers.swift fix(schema): a reference to an all group must have maxOccurs 1 2026-06-20 19:14:33 +02:00
SchemaSubstitutionType.swift Reject complex substitutions for anySimpleType heads 2026-06-18 23:04:11 +02:00
SchemaUndeclaredNamespace.swift fix(schema): reject references into never-imported namespaces 2026-06-20 13:50:55 +02:00
SchemaWildcardNamespace.swift feat(schema): validate wildcard namespace constraint value space 2026-06-14 11:00:45 +02:00
SchemaXSIAttribute.swift fix(schema): forbid attribute declarations in the XSI namespace 2026-06-20 14:33:14 +02:00
SimpleType.swift fix(schema): advance XSTS valid-instances-rejected to 4 (#146) 2026-06-16 22:22:05 +02:00
StreamingXSDValidator.swift fix(schema): streaming validator applies default/fixed value constraints 2026-06-20 17:38:45 +02:00
TypeDerivation.swift feat(schema): XSD derivation control (abstract, block, final, redefine) 2026-06-08 14:14:23 +02:00
XPathQueryCache.swift fix(schema): default/fixed value for identity-constraint fields; invalid-instances-accepted 50 to 45 (#147) 2026-06-18 14:47:47 +02:00
XSDAttributeParser.swift fix(schema): exclude use="prohibited" attributes from effective uses at instance time; invalid-instances-accepted 43 to 39 (#147) 2026-06-18 15:28:35 +02:00
XSDCompletions.swift fix(schema): enforce NameAndTypeOK nillable clause in particle restriction (#145) 2026-06-17 17:25:10 +02:00
XSDComplexContent.swift fix(schema): advance XSTS valid-instances-rejected to 4 (#146) 2026-06-16 22:22:05 +02:00
XSDContext.swift fix(schema): count content-model occurrences 2026-06-19 23:32:04 +02:00
XSDDerivation.swift fix(schema): bar a substitution-group member blocked by the head's type; invalid-instances-accepted 53 to 50 (#147) 2026-06-18 14:02:14 +02:00
XSDDerivationTables.swift fix(schema): key a local element's block by its effective instance namespace; invalid-instances-accepted 32 to 31 (#147) 2026-06-18 16:12:08 +02:00
XSDParser.swift fix(schema): make the container-location root fallback live 2026-06-19 23:32:04 +02:00
XSDParserHelpers.swift fix(schema): default/fixed value for identity-constraint fields; invalid-instances-accepted 50 to 45 (#147) 2026-06-18 14:47:47 +02:00
XSDParserParticles.swift fix(schema): count content-model occurrences 2026-06-19 23:32:04 +02:00
XSDParserTypeReferences.swift fix(schema): an untyped substitutionGroup member inherits its head's type 2026-06-20 02:47:07 +02:00
XSDParserUnion.swift docs: align stale figures with code and the enforced XSTS gate 2026-06-19 23:32:04 +02:00
XSDSchemaValidations.swift feat(validation,schema): composable validation framework and cross-document composition 2026-06-16 09:57:43 +02:00
XSDSimpleContentParser.swift Reject invalid simpleContent inline restrictions 2026-06-18 22:01:01 +02:00
XSDSimpleParser.swift refactor(schema): surface facet/pattern validity as a Validation, not a parse-time report (#161) 2026-06-18 00:02:20 +02:00
XSDSimpleParser+Facets.swift fix(schema): advance XSTS valid-instances-rejected to 4 (#146) 2026-06-16 22:22:05 +02:00
XSDSubstitutionMembers.swift fix(schema): stop blocked substitution chaining 2026-06-19 08:37:19 +02:00
XSDValidations.swift fix(schema): default/fixed value for identity-constraint fields; invalid-instances-accepted 50 to 45 (#147) 2026-06-18 14:47:47 +02:00
XSDWildcardParser.swift fix(schema): intersect a complex type's attribute wildcard sources; invalid-instances-accepted 94 to 89 (#147) 2026-06-18 11:21:32 +02:00